pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[SQL/BUGS] (possible) inconsistent behaviour of timestamp?
2+ messages / 2 participants
[nested] [flat]

* [SQL/BUGS] (possible) inconsistent behaviour of timestamp?
@ 2002-11-26 13:54  Rison, Stuart <srison@rvc.ac.uk>
  0 siblings, 1 reply; 2+ messages in thread

From: Rison, Stuart @ 2002-11-26 13:54 UTC (permalink / raw)
  To: pgsql-sql; 'pgsql-bugs@postgresql.org' <pgsql-bugs@postgresql.org>

Here's an "interesting" timestamp related postgreSQL quirk:

testdb2=# select "timestamp"('now');
         timestamp
----------------------------
 2002-11-26 13:47:12.454157
(1 row)

testdb2=# select 'now'::timestamp;
         timestamptz
------------------------------
 2002-11-26 13:47:34.88358+00
(1 row)

testdb2=# select timestamp 'now';
          timestamptz
-------------------------------
 2002-11-26 13:47:47.701731+00
(1 row)

The first SELECT returns a 'timestamp', but the next two return a
'timestamptz' (presumably with timezone); is this inconsitent behaviour?

Cheers,

Stuart.
Royal Veterinary College
London, UK



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [SQL] [SQL/BUGS] (possible) inconsistent behaviour of timestamp?
@ 2002-11-27 02:14  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Rison, Stuart <srison@rvc.ac.uk>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-11-27 02:14 UTC (permalink / raw)
  To: Rison, Stuart <srison@rvc.ac.uk>; +Cc: pgsql-sql; 'pgsql-bugs@postgresql.org' <pgsql-bugs@postgresql.org>

"Rison, Stuart" <srison@rvc.ac.uk> writes:
> The first SELECT returns a 'timestamp', but the next two return a
> 'timestamptz' (presumably with timezone); is this inconsitent behaviour?

Yes.  It's a transitional behavior in 7.2: timestamp without any quotes
is translated by the parser to timestamptz (ie, timestamp with time
zone).  Quotes suppress the renaming, however.

We did that deliberately for one release to ease updating, because PG's
old "datetime" datatype corresponds to timestamptz, not timestamp-without-
time-zone.  As of 7.3 that renaming doesn't happen any more, and
undecorated timestamp means timestamp without time zone, per spec.

Confused yet?  I'm not sure that this update plan was really a great
idea, but we agreed to it a release or two back, and we're sticking to
it...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-11-27 02:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-26 13:54 [SQL/BUGS] (possible) inconsistent behaviour of timestamp? Rison, Stuart <srison@rvc.ac.uk>
2002-11-27 02:14 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox