Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 12:27 AM
Will Trillich
Guest
 
Posts: n/a
Default set timestamp oddness

not sure what it's supposed to look like, but i'm reasonably
sure 'show time zone' shouldn't produce this--

db=# set timezone = '-6';
SET
db=# show timezone;
TimeZone
----------------
-00:00:00.0216
(1 row)

very odd, that!

i'm using

$ psql -V
psql (PostgreSQL) 7.4.2
contains support for command-line editing

on my debian/sarge (testing) system.



db=# set timezone to '-5:00';
ERROR: unrecognized time zone name: "-5:00"

pooh. but this works, of course:

hits=# set timezone = 'America/Chicago';
SET
hits=# show timezone;
TimeZone
-----------------
America/Chicago
(1 row)

(or anything else under /usr/share/zoneinfo...)



also--

db=# select now() at time zone 'America/Chicago';
ERROR: time zone "america/chicago" not recognized

doesn't that conflict with the "set" command above? is there a
good reason for the syntax of the timezone to be different here?

db=# select now() at time zone '-5';
ERROR: time zone "-5" not recognized

also in conflict with what 'set time zone' accepts...

db=# select now() at time zone 'GMT-5';
ERROR: time zone "gmt-5" not recognized


oh well, it was worth a shot.

but then:

db=# select now() at time zone 'CDT';
timezone
----------------------------
2004-04-05 16:26:49.991342
(1 row)

the one that "set time zone" does NOT accept, "at time zone" DOES.
hmm?

--
"Why did they hard code that value into the program?".
"My only guess would be to maximize suckage."
http://suso.suso.org/docs/apache_and.../part4-2.phtml

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

  #2  
Old November 23rd, 2005, 12:27 AM
Tom Lane
Guest
 
Posts: n/a
Default Re: set timestamp oddness

Will Trillich <will@serensoft.com> writes:[color=blue]
> db=# set timezone = '-6';
> SET
> db=# show timezone;
> TimeZone
> ----------------
> -00:00:00.0216
> (1 row)[/color]

hmm ... I get something reasonable here:

regression=# set timezone = '-6';
SET
regression=# show timezone;
TimeZone
-----------
-06:00:00
(1 row)

Could you poke into this more and find out why it goes wrong on your
platform?
[color=blue]
> db=# set timezone to '-5:00';
> ERROR: unrecognized time zone name: "-5:00"[/color]

That one works for me too...
[color=blue]
> the one that "set time zone" does NOT accept, "at time zone" DOES.
> hmm?[/color]

This is not totally surprising, seeing that they go through completely
different code paths. I believe "set time zone" accepts whatever the
underlying OS's tzset() routine will take, whereas "at time zone"
only accepts timezone names listed in datetime.c's builtin table.
The difference could and someday should be eliminated, but it will
take rewriting a lot of OS-level timezone support for ourselves :-(

regards, tom lane

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

http://archives.postgresql.org

 

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles