Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Karsten Hilbert
On Sun, Apr 24, 2005 at 04:34:31PM -0600, Michael Fuhr wrote: gnumed= select version(); version --- PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.3 That

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Tom Lane
Karsten Hilbert [EMAIL PROTECTED] writes: The fact that different versions of PostgreSQL get it right or wrong in a variety of ways indicates that the logic may need to be fixed but does show that in principle it is quite possible. 7.1's version of AT TIME ZONE was so badly broken that it

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Karsten Hilbert
On Mon, Apr 25, 2005 at 03:05:12AM -0400, Tom Lane wrote: The fact that different versions of PostgreSQL get it right or wrong in a variety of ways indicates that the logic may need to be fixed but does show that in principle it is quite possible. 7.1's version of AT TIME ZONE was so

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Michael Fuhr
On Mon, Apr 25, 2005 at 08:28:47AM +0200, Karsten Hilbert wrote: gnumed= create teable test (f timestamp with time zone); CREATE Does that really work in 7.1.3? Trying to create a teable fails This results from script logging backspaces into the log file instead of deleting

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Karsten Hilbert
select f, f::timestamp at time zone 'MEZ' from test; f | timezone ---+ 2005-04-24 22:25:51.669218+00 | 2005-04-24 23:25:51.669218 (1 row) Huh ? This IS different

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Tom Lane
Michael Fuhr [EMAIL PROTECTED] writes: The problem I was discussing involves getting *different* time zone specifictions in the output. That is, something like this (which apparently is possible in 7.1.3 but not in later versions): f | timezone

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-25 Thread Karsten Hilbert
On Mon, Apr 25, 2005 at 11:36:23AM -0400, Tom Lane wrote: ---+--- 2005-04-24 22:25:51.669218+00 | 2005-04-24 23:25:51.669218+01 It was not really possible in 7.1 either (nor any previous version). The secret to the above is that in

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-24 Thread Karsten Hilbert
As far as I know, it's not possible to get output like the following from the same query if the data type is timestamp with time zone: 2005-04-21 15:00:00-07 2005-04-21 22:00:00+00 Doesn't at time zone do what you need ? Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-24 Thread Michael Fuhr
On Sun, Apr 24, 2005 at 05:21:41PM +0200, Karsten Hilbert wrote: As far as I know, it's not possible to get output like the following from the same query if the data type is timestamp with time zone: 2005-04-21 15:00:00-07 2005-04-21 22:00:00+00 Doesn't at time zone do what you

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-24 Thread Karsten Hilbert
On Sun, Apr 24, 2005 at 10:49:13AM -0600, Michael Fuhr wrote: As far as I know, it's not possible to get output like the following from the same query if the data type is timestamp with time zone: 2005-04-21 15:00:00-07 2005-04-21 22:00:00+00 Doesn't at time zone do what you

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-24 Thread Michael Fuhr
On Sun, Apr 24, 2005 at 07:09:44PM +0200, Karsten Hilbert wrote: Isn't the following what you want? ... gnumed= select version(); version --- PostgreSQL 7.1.3 on

[GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Steve - DND
These attempts were run at 4/21/2005 13:15:00 -07. UTC: 4/21/2005 20:15:00 SELECT timeofday()::timestamp 04/21/2005 13:15:00 SELECT timezone('UTC', now()) 04/21/2005 20:15:00 PM SELECT timezone('UTC', timeofday()::timestamp)::timestamp without time zone 04/21/2005 06:15:00 - What the heck is

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Michael Fuhr
On Thu, Apr 21, 2005 at 01:35:16PM -0700, Steve - DND wrote: These attempts were run at 4/21/2005 13:15:00 -07. UTC: 4/21/2005 20:15:00 SELECT timeofday()::timestamp 04/21/2005 13:15:00 SELECT timezone('UTC', now()) 04/21/2005 20:15:00 PM SELECT timezone('UTC',

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Steve - DND
Perhaps this is what you want: SELECT timezone('UTC', timeofday()::timestamptz); That did it. Strangely, I thought I had tried that already, but I must not have. My next question would be if I did: SELECT timezone('UTC', timeofday()::timestamptz):timestamptz; Why do I get the

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Michael Fuhr
On Thu, Apr 21, 2005 at 04:11:57PM -0700, Steve - DND wrote: Perhaps this is what you want: SELECT timezone('UTC', timeofday()::timestamptz); That did it. Strangely, I thought I had tried that already, but I must not have. My next question would be if I did: SELECT

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Steve - DND
Again looking at the documentation, we see that timestamp with time zone AT TIME ZONE zone means Convert UTC to local time in given time zone and has a return type of timestamp without time zone. So if we run the above command without the final cast around 16:25 PDT / 23:25 UTC, we get

Re: [GENERAL] timezone() with timeofday() converts the wrong direction?

2005-04-21 Thread Michael Fuhr
On Thu, Apr 21, 2005 at 05:56:41PM -0700, Steve - DND wrote: Okay, I understand what you're saying now, but then is a time without a timezone implicitly assumed to be UTC? Is there a way to explicitly make the timezone on the stamp be UTC, if the prior is not the case? See Date/Time Types in