473,786 Members | 2,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2515
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
9305
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 three dropdow boxes for hours, minutes, and AM/PM. All of these need to be considered together and converted to one Unix Timestamp and then inserted to the MYSQL date field. The type of field is INT (11) so that I can instead of the standard...
2
10966
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 possible. I have 2 tables, one called ACCOUNTS and one called STOCK. These tables have the usual ints, varchars, etc and have a timestamp field as well.
2
5185
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 (ApplicationID int ,timestamp datetime)
3
1794
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 /Library/Python/2.3/site-packages directory, and they import OK via command line python. However, when I perform the import from a cgi script, python fails to find the module. It is definately something to do with the symlink, as the CGI works OK if I copy the directory into...
7
4063
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 error. If I can not store the value, how should I return the timestamp to the database (with other values) to compare with the current timestamp to check for updates. You answers will be greatly appreciated.
2
720
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 columns, and ultimately feed the result into a graph-drawing web thingy. I'm trying a few different ways to get what seems to be the same data, and seeing some odd behavior from the query planner. The table looks like this:
2
4372
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 showing what I am experiencing. The last own shows how converting timestamps to dates and then ordering doesn't give you the order you want. Maybe you should just order by the timestamp to begin with. However Date does not understand infinity at all.
22
6433
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 database. The original Update and Delete SP's all use a timestamp for concurreny checking. I am trying to use the same Update SP from my sqlDataSource but I keep getting the following error:
7
6113
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
1511
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 bug or my not understanding how the << overload is chosen. -Chris -------------------- #include <iostream>
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.