![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Recently there has been some discussion about attaching a timezone to a timestamp and some other discussion about including a 'day' part in the interval type. These two features impact each other, since if you add a 'day' to a timestamp the result can depend on what timezone the timestamp is supposed to be in. It probably makes more sense to use a timezone associated with the timestamp than say the timezone GUC or the fixed timezone UTC. |
|
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a tool for doing 5% of the work and then sitting around waiting for someone else to do the other 95% so you can sue them. |
#3
| |||
| |||
|
|
I agree. One issue I can think of is that if you store each timestamp as a (seconds,timezone) pair, the storage requirements will balloon, since timezone can be something like "Australia/Sydney" and this will be repeated for every value in the table. I don't know how to deal easily with this since there is no unique identifier to timezones and no implicit order. The only solution I can think of is have initdb create a pg_timezones table which assigns an OID to each timezone it finds. Then the type can use that. I think this is a good solution actually, any thoughts? |
#4
| |||
| |||
|
|
Martijn, I agree. One issue I can think of is that if you store each timestamp as a (seconds,timezone) pair, the storage requirements will balloon, since timezone can be something like "Australia/Sydney" and this will be repeated for every value in the table. I don't know how to deal easily with this since there is no unique identifier to timezones and no implicit order. The only solution I can think of is have initdb create a pg_timezones table which assigns an OID to each timezone it finds. Then the type can use that. I think this is a good solution actually, any thoughts? Using OID's is a good idea, but I think a canonical list of known timezone to OID mappings must be maintained and shipped with the PostgreSQL core. |
|
If OID's are generated at initdb time, there's a great risk that the OID's will differ between databases using different versions of PostgreSQL. That in turn might have some negative implications for data exchange. |
|
Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a tool for doing 5% of the work and then sitting around waiting for someone else to do the other 95% so you can sue them. |
#5
| |||
| |||
|
|
On Wed, Oct 27, 2004 at 09:21:39AM +0200, Thomas Hallgren wrote: Using OID's is a good idea, but I think a canonical list of known timezone to OID mappings must be maintained and shipped with the PostgreSQL core. How can there be a "canonical list of known timezones" if every operating system has it's own list. Maybe you can provide a base list, but you have to allow for people to make their own. |
#6
| |||
| |||
|
|
Using OID's is a good idea, but I think a canonical list of known timezone to OID mappings must be maintained and shipped with the PostgreSQL core. If OID's are generated at initdb time, there's a great risk that the OID's will differ between databases using different versions of PostgreSQL. That in turn will have some negative implications for data exchange. Regards, Thomas Hallgren |
#7
| |||
| |||
|
|
Recently there has been some discussion about attaching a timezone to a timestamp and some other discussion about including a 'day' part in the interval type. These two features impact each other, since if you add a 'day' to a timestamp the result can depend on what timezone the timestamp is supposed to be in. It probably makes more sense to use a timezone associated with the timestamp than say the timezone GUC or the fixed timezone UTC. |
#8
| |||
| |||
|
|
If you add a 'day' to a timestamp, it should be identical to adding 24 hours. |
|
For example, what is '2am April 3rd 2004 US/Eastern + 1 day'? 2am on April 4th 2004 didn't exist in that timezone because the clocks were put forward and that hour skipped. |
#9
| |||
| |||
|
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Bruno Wolff III wrote: | Recently there has been some discussion about attaching a timezone to | a timestamp and some other discussion about including a 'day' part | in the interval type. These two features impact each other, since | if you add a 'day' to a timestamp the result can depend on what timezone | the timestamp is supposed to be in. It probably makes more sense to use | a timezone associated with the timestamp than say the timezone GUC or the | fixed timezone UTC. If you add a 'day' to a timestamp, it should be identical to adding 24 hours. Any other interpretation leads to all sorts of wierd ambiguities. For example, what is '2am April 3rd 2004 US/Eastern + 1 day'? 2am on April 4th 2004 didn't exist in that timezone because the clocks were put forward and that hour skipped. If you round up to the nearest existant time, you then have the issue that '2am April 3rd + 1 day == 3am Aril 3rd + 1 day'. - -- Stuart Bishop <stuart (AT) stuartbishop (DOT) net http://www.stuartbishop.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFBge+sAfqZj7rGN0oRAgInAJsEuYkxX6/jsaszquhjEX/PH3nXvACfVBW9 Z3sfU5XGgxSOI77vuOOOzKA= =euY6 -----END PGP SIGNATURE----- ---------------------------(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) . |
#10
| |||
| |||
|
|
1 day should always be calculated as 24 hours, just as an hour is calculated as 60 minutes... |
|
Since interval does not store an actual time range, it is not sensitive to daylight savings. |
![]() |
| Thread Tools | |
| Display Modes | |
| |