Surprise AT TIME ZONE behaviour (buglet?)?

From: Allan Engelhardt <allane(at)cybaea(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Surprise AT TIME ZONE behaviour (buglet?)?
Date: 2002-02-04 19:00:23
Message-ID: 3C5EDA47.4070303@cybaea.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

test=# select version();
version
-------------------------------------------------------------
PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)
test=# create table tz (t timestamp, tz text);
CREATE
test=# insert into tz values (now(), 'GMT');
INSERT 340574 1
test=# insert into tz values (now(), 'PST');
INSERT 340575 1
test=# select t at time zone tz from tz;
timezone
------------------------
2002-02-04 18:43:55+00
2002-02-04 10:44:00-08
(2 rows)

Can I first say that I am dead-impressed that this select statement works!!
Well done and a million thanks to whoever implemented it such that the argument
to AT TIME ZONE is a SQL statement.

Also thanks to the authors of "Practical PostgreSQL" (O'Reilly 2002) for
pointing this feature out to me in the first place. It is a fine book, even if
they do get the definition of PST wrong (John and Joshua: it is GMT-8, cf. above).

Two questions:

1. Am I the only one who is surprised by the column name ('timezone' instead of
't')? A parser buglet (assuming noise after column name is AS)?

2. Is this really supposed to work? More precisely: can I count on it if future
releases? The documentation
(http://candle.pha.pa.us/main/writings/pgsql/sgml/sql-select.html) does not
mention it....

Allan.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Elaine Lindelef 2002-02-04 19:08:57 Re: Change size of varchar(20) field
Previous Message Frank Bax 2002-02-04 17:46:49 Re: Change size of varchar(20) field