Re: [PATCHES] (8.1) to_timestamp correction (epoch to timestamptz)

2005-06-04 Thread Michael Glaesemann

Bruce,

Please note that this patch is a correction and replacement for an  
earlier patch in the queue. The patch accompanying the message

http://candle.pha.pa.us/mhonarc/patches/msg8.html
should be removed from the queue and not applied.

The one (originally) attached to this message should be applied.

Thanks!

Michael Glaesemann
grzm myrealbox com

On Jun 5, 2005, at 9:17 AM, Bruce Momjian wrote:



Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

-- 
-



Michael Glaesemann wrote:


Note: This patch is intended for 8.1 (as was the original).

I believe the previous patch I submitted to convert Unix epoch to
timestamptz contains a bug relating to its use of AT TIME ZONE.  
Please

find attached a corrected patch diffed against HEAD, which includes
documentation.

The original function was equivalent to

CREATE FUNCTION to_timestamp (DOUBLE PRECISION)
 RETURNS timestamptz
 LANGUAGE SQL AS '
 select (
 (\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
 at time zone \'UTC\'
 )
 ';

The AT TIME ZONE 'UTC' removes the time zone from the timestamptz,
returning timestamp. However, the function is declared to return
timestamptz. The original patch appeared to work, but creating this
equivalent function fails as it doesn't return the declared datatype.

The corrected function restores the time zone with an additional AT
TIME ZONE 'UTC':

CREATE FUNCTION to_timestamp (double precision)
 returns timestamptz
 language sql as '
 select (
 (\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
 at time zone \'UTC\'
 ) at time zone \'UTC\'
 ';


Michael Glaesemann
grzm myrealbox com




[ Attachment, skipping... ]



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
   (send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [PATCHES] (8.1) to_timestamp correction (epoch to timestamptz)

2004-12-18 Thread Bruce Momjian

This has been saved for the 8.1 release:

http:/momjian.postgresql.org/cgi-bin/pgpatches2

---

Michael Glaesemann wrote:
 Note: This patch is intended for 8.1 (as was the original).
 
 I believe the previous patch I submitted to convert Unix epoch to 
 timestamptz contains a bug relating to its use of AT TIME ZONE. Please 
 find attached a corrected patch diffed against HEAD, which includes 
 documentation.
 
 The original function was equivalent to
 
 CREATE FUNCTION to_timestamp (DOUBLE PRECISION)
  RETURNS timestamptz
  LANGUAGE SQL AS '
  select (
  (\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
  at time zone \'UTC\'
  )
  ';
 
 The AT TIME ZONE 'UTC' removes the time zone from the timestamptz, 
 returning timestamp. However, the function is declared to return 
 timestamptz. The original patch appeared to work, but creating this 
 equivalent function fails as it doesn't return the declared datatype.
 
 The corrected function restores the time zone with an additional AT 
 TIME ZONE 'UTC':
 
 CREATE FUNCTION to_timestamp (double precision)
  returns timestamptz
  language sql as '
  select (
  (\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
  at time zone \'UTC\'
  ) at time zone \'UTC\'
  ';
 
 
 Michael Glaesemann
 grzm myrealbox com
 

[ Attachment, skipping... ]

 

 
 ---(end of broadcast)---
 TIP 8: explain analyze is your friend

-- 
  Bruce Momjian|  http://candle.pha.pa.us
  [EMAIL PROTECTED]   |  (610) 359-1001
  +  If your life is a hard drive, |  13 Roberts Road
  +  Christ can be your backup.|  Newtown Square, Pennsylvania 19073

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[PATCHES] (8.1) to_timestamp correction (epoch to timestamptz)

2004-12-12 Thread Michael Glaesemann
Note: This patch is intended for 8.1 (as was the original).
I believe the previous patch I submitted to convert Unix epoch to 
timestamptz contains a bug relating to its use of AT TIME ZONE. Please 
find attached a corrected patch diffed against HEAD, which includes 
documentation.

The original function was equivalent to
CREATE FUNCTION to_timestamp (DOUBLE PRECISION)
RETURNS timestamptz
LANGUAGE SQL AS '
select (
(\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
at time zone \'UTC\'
)
';
The AT TIME ZONE 'UTC' removes the time zone from the timestamptz, 
returning timestamp. However, the function is declared to return 
timestamptz. The original patch appeared to work, but creating this 
equivalent function fails as it doesn't return the declared datatype.

The corrected function restores the time zone with an additional AT 
TIME ZONE 'UTC':

CREATE FUNCTION to_timestamp (double precision)
returns timestamptz
language sql as '
select (
(\'epoch\'::timestamptz + $1 * \'1 second\'::interval)
at time zone \'UTC\'
) at time zone \'UTC\'
';
Michael Glaesemann
grzm myrealbox com


to_timestamp-20041212.diff
Description: application/text


---(end of broadcast)---
TIP 8: explain analyze is your friend