Re: possibly a bug?
От | Josh Berkus |
---|---|
Тема | Re: possibly a bug? |
Дата | |
Msg-id | web-680587@davinci.ethosmedia.com обсуждение исходный текст |
Ответ на | possibly a bug? (Ewald Geschwinde <webmaster@geschwinde.net>) |
Список | pgsql-novice |
Ewald, > Is this a bug or Am i Wrong? It's not a bug, it's a feature :-) Your problem is that you're convertng back and forth between DATE (which does not track hours) and TIMESTAMP + INTERVAL, which does track hours. Therefore you arrive at this problem: > beta=# SELECT ('2001-10-28'::date + '1 day'::interval)::date; > ?column? > ------------ > 2001-10-28 > (1 row) Ah, but you're not seeing the whole story: beta=# SELECT ('2001-10-28'::date + '1 day'::interval)::TIMESTAMP ?column? ------------ 2001-10-28 23:00:00 (1 row) Aha! And, if we look at a calendar, we see that 10.28.2001 was the end of daylight savings time in 2001! For your purposes, it would be better not to muddy the waters by tinkering with the vagaries of TIMESTAMP. Thus, you should: SELECT ('2001-10-28'::DATE + 1); ?column? ------------ 2001-10-29 (1 row) FOr more info, see my DATE/TIME FAQ on http://techdocs.postgtresql.org/ -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
В списке pgsql-novice по дате отправления: