dbTalk Databases Forums  

[BUGS] Non-standard TIMESTAMP WITH TIME ZONE literal handling

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Non-standard TIMESTAMP WITH TIME ZONE literal handling in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Troels Arvin
 
Posts: n/a

Default [BUGS] Non-standard TIMESTAMP WITH TIME ZONE literal handling - 08-07-2003 , 10:11 AM






Hello,

In Jim Melton and Alan Simon's "SQL:1999 - Understanding Relational
Language Components" (ISBN 1-55860-456-1), they write that the following
is to be interpreted as a TIMESTAMP WITH TIME ZONE value:

TIMESTAMP '2003-07-29 13:19:30.5+02:00'

PostgreSQL interprets the above as a TIMESTAMP WITHOUT TIME ZONE value of
'2003-07-29 13:19:30.5', i.e. it simply discards the '+02:00' part and
fails to interpret it as being of TIMESTAMP WITH TIME ZONE type.

Unless Melton+Simon are wrong, PostgreSQL is not completely following
SQL:1999 regarding TIMESTAMP-like literal parsing.

Furthermore, as Oracle behaves as Melton+Simon describes, subtle, but
potentially nasty portability problems can be imagined, hurting people
porting to/from Oracle.

--
Greetings from Troels Arvin, Copenhagen, Denmark



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] Non-standard TIMESTAMP WITH TIME ZONE literal handling - 08-07-2003 , 10:32 AM






Troels Arvin <troels (AT) arvin (DOT) dk> writes:
Quote:
In Jim Melton and Alan Simon's "SQL:1999 - Understanding Relational
Language Components" (ISBN 1-55860-456-1), they write that the following
is to be interpreted as a TIMESTAMP WITH TIME ZONE value:

TIMESTAMP '2003-07-29 13:19:30.5+02:00'

PostgreSQL interprets the above as a TIMESTAMP WITHOUT TIME ZONE value of
'2003-07-29 13:19:30.5', i.e. it simply discards the '+02:00' part and
fails to interpret it as being of TIMESTAMP WITH TIME ZONE type.
That's true, and I think we are unlikely to change it. Postgres
interprets this construct as a special case of a general
datatype_name 'literal string'
construction. To allow the contents of the literal to determine the
datatype specification would break the general construct completely.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
  #3  
Old   
Stephan Szabo
 
Posts: n/a

Default Re: [BUGS] Non-standard TIMESTAMP WITH TIME ZONE literal handling - 08-07-2003 , 10:40 AM



On Thu, 7 Aug 2003, Troels Arvin wrote:

Quote:
Hello,

In Jim Melton and Alan Simon's "SQL:1999 - Understanding Relational
Language Components" (ISBN 1-55860-456-1), they write that the following
is to be interpreted as a TIMESTAMP WITH TIME ZONE value:

TIMESTAMP '2003-07-29 13:19:30.5+02:00'

PostgreSQL interprets the above as a TIMESTAMP WITHOUT TIME ZONE value of
'2003-07-29 13:19:30.5', i.e. it simply discards the '+02:00' part and
fails to interpret it as being of TIMESTAMP WITH TIME ZONE type.

Unless Melton+Simon are wrong, PostgreSQL is not completely following
SQL:1999 regarding TIMESTAMP-like literal parsing.
I think they're correct and we're wrong:

SQL92 5.3 Syntax rules:
17)The data type of a <timestamp literal> that does not specify
<time zone interval> is TIMESTAMP(P), where P is the number of
digits in <seconds fraction>, if specified, and 0 otherwise.
The data type of a <timestamp literal> that specifies <time zone
interval> is TIMESTAMP(P) WITH TIME ZONE, where P is the number
of digits in <seconds fraction>, if specified, and 0
otherwise.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.