dbTalk Databases Forums  

[BUGS] Setting time zone commands

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


Discuss [BUGS] Setting time zone commands in the mailing.database.pgsql-bugs forum.



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

Default [BUGS] Setting time zone commands - 12-02-2003 , 06:42 AM






Hi!

Seeing no comments on the same issue I raised in=20
pgsql-general list, I am posting it here.
The documentation (Appendix B.2. Date/Time Key Words) says=20
that the following SQL's are legal, but actually they are=20
not:

SET TIME ZONE TO '<any time zone abbreviation>'
(examples:
SET TIMEZONE TO 'NZDT';
SET TIMEZONE TO 'EST';
)

However, the following SQL's are accepted by postgres:

SET TIME ZONE TO 0
SET TIME ZONE TO 9
SET TIME ZONE TO -4

Regards,
CN

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

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

Default Re: [BUGS] Setting time zone commands - 12-02-2003 , 09:10 AM






"cnliou" <cnliou (AT) so-net (DOT) net.tw> writes:
Quote:
The documentation (Appendix B.2. Date/Time Key Words) says
that the following SQL's are legal, but actually they are
not:
SET TIME ZONE TO '<any time zone abbreviation>'
The documentation does not actually say any such thing, although its
failure to clarify what it *is* saying isn't great. I have reworded it
as follows in CVS tip:

: Table B-4 shows the time zone abbreviations recognized by PostgreSQL in
: date/time input values. PostgreSQL uses internal tables for time zone
: input decoding, since there is no standard operating system interface to
: provide access to general, cross-time zone information. The underlying
: operating system is used to provide time zone information for output,
: however.
:
: Keep in mind also that the time zone names recognized by SET TIMEZONE
: are operating-system dependent and may have little to do with Table
: B-4. For example, some systems recognize values like 'Europe/Rome' in
: SET TIMEZONE.

We do not make any attempt to document what timezone names are accepted
by SET TIMEZONE, because there is in general no way to find out :-(

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


Reply With Quote
  #3  
Old   
cnliou
 
Posts: n/a

Default Re: [BUGS] Setting time zone commands - 12-02-2003 , 09:57 AM



Thank you! Tom,

Quote:
The documentation does not actually say any such thing,
although its
failure to clarify what it *is* saying isn't great. I have
reworded it
as follows in CVS tip:

: Table B-4 shows the time zone abbreviations recognized by
PostgreSQL in
: date/time input values. PostgreSQL uses internal tables
for time zone
: input decoding, since there is no standard operating
system interface to
: provide access to general, cross-time zone information.
The underlying
: operating system is used to provide time zone information
for output,
: however.
:
: Keep in mind also that the time zone names recognized by
SET TIMEZONE
: are operating-system dependent and may have little to do
with Table
: B-4. For example, some systems recognize values like
'Europe/Rome' in
: SET TIMEZONE.

We do not make any attempt to document what timezone names
are accepted
by SET TIMEZONE, because there is in general no way to find
out :-(

So, what is the official syntax? Is it like the following?

SET TIME ZONE TO 8:30
SET TIMEZONE TO 8:30
SET TIME ZONE TO -5
SET TIMEZONE TO -5

Regards,

CN

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


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

Default Re: [BUGS] Setting time zone commands - 12-02-2003 , 10:32 AM



"cnliou" <cnliou (AT) so-net (DOT) net.tw> writes:
Quote:
So, what is the official syntax?
See the SET command's reference page. I believe you need to quote
anything that doesn't look like an identifier or number.

regards, tom lane

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

http://archives.postgresql.org


Reply With Quote
  #5  
Old   
cnliou
 
Posts: n/a

Default Re: [BUGS] Setting time zone commands - 12-02-2003 , 09:43 PM



¡° Include¡m"Tom Lane" <tgl (AT) sss (DOT) pgh.pa.us>¡nwrote:
Quote:
So, what is the official syntax?

See the SET command's reference page. I believe you need
to quote
anything that doesn't look like an identifier or number.
Thank you very much! You have clarified all my timestamp and
time zone questions except the last minor two as follows:

(1) The query using UTC offset hours (SET TIME ZONE '<0 - 23
integers>') to set time zone will be the legal SQL command
for quite a while, won't it?

(2) What is the correct syntax to set time zones having 30
minutes offset UTC?

db1=# set time zone '08:30';
ERROR: unrecognized time zone name: "08:30"
db1=# set time zone 08:30;
ERROR: syntax error at or near ":" at character 17
db1=# set time zone '-03:30';
ERROR: unrecognized time zone name: "-03:30"
db1=# set time zone 'NST';
ERROR: unrecognized time zone name: "NST"

Regards,
CN

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster


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

Default Re: [BUGS] Setting time zone commands - 12-02-2003 , 10:54 PM



"cnliou" <cnliou (AT) so-net (DOT) net.tw> writes:
Quote:
(2) What is the correct syntax to set time zones having 30
minutes offset UTC?
"SET TIME ZONE 8.5" works, as does "SET TIME ZONE INTERVAL '08:30';"

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


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.