473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Nov 23 '05 #1
1 2489
Will Trillich <wi**@serensoft.com> writes:
db=# set timezone = '-6';
SET
db=# show timezone;
TimeZone
----------------
-00:00:00.0216
(1 row)
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?
db=# set timezone to '-5:00';
ERROR: unrecognized time zone name: "-5:00"
That one works for me too...
the one that "set time zone" does NOT accept, "at time zone" DOES.
hmm?


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

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
2
by: Astra | last post by:
Hi All I know an SQL Server timestamp seems to be as useful as rocking horse for show jumping, but I'm hoping you know a 'fudge' to get me round a problem or at least confirm that it isn't...
2
by: rong.guo | last post by:
Hello Group, I am having a really weird problem... Can anyone tell the difference between Query 1 and Query 2 below? Why Query 2 excludes '2/28/2005'? Many thanks! create table a...
3
by: John Abel | last post by:
Hi, I'm running Python 2.3.5/2.4.2 on OSX 10.4.2, and am trying to run CGI scripts using the builtin Apache. For ease, I've symlinked my custom modules into the...
7
by: mybappy | last post by:
Hi: I am trying to use timestamp field of SQL Server to maintain concurrency. My problem is how do I store the timestamp value in my webform. The hidden field does not work as I get some cast...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
22
by: Mal Ball | last post by:
I hope I have the right forum for this question. I have an existing Windows application which uses a SQL Server database and stored procedures. I am now developing a web application to use the same...
7
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
1
by: cedarmillxing215 | last post by:
The oddness is on the last line of code. This is stripped down as far as I could figure, and I provide several similar examples that work as expected. I have no idea whether this is a compiler...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.