Postgresql 7.0 bug

Started by rootalmost 26 years ago3 messagesbugs
Jump to latest
#1root
root@esc.rosemere.qc.ca

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Eric Prevost-Dansereau
Your email address : eric@esc.rosemere.qc.ca

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium II

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.13 ELF

PostgreSQL version (example: PostgreSQL-6.5.1): PostgreSQL-7.0

Compiler used (example: gcc 2.8.0) : gcc 2.91.66

Please enter a FULL description of your problem:
------------------------------------------------

When I execute from psql:
SELECT '2000-04-03'::timestamp - '2000-04-02'::timestamp;

I get:
?column?
----------
23:00
(1 row)

Why april 2nd, 2000 don't last 1 day (or 24 hours) ?

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

SELECT '2000-04-03'::timestamp - '2000-04-02'::timestamp;

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

I don't have any idea

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: root (#1)
Re: Postgresql 7.0 bug

root <root@esc.rosemere.qc.ca> writes:

SELECT '2000-04-03'::timestamp - '2000-04-02'::timestamp;
?column?
----------
23:00
(1 row)

Why april 2nd, 2000 don't last 1 day (or 24 hours) ?

Here in the USA, that is the right answer because 4/2 was a daylight
savings switchover date. Notice the difference in timezones:

regression=# select '2000-04-03'::timestamp;
?column?
------------------------
2000-04-03 00:00:00-04
(1 row)

regression=# select '2000-04-02'::timestamp;
?column?
------------------------
2000-04-02 00:00:00-05
(1 row)

If it wasn't a DST change date where you live, then you are running
with the wrong timezone setting...

regards, tom lane

#3Karl DeBisschop
kdebisschop@h00a0cc3b7988.ne.mediaone.net
In reply to: root (#1)
Re: Postgresql 7.0 bug

root wrote:

When I execute from psql:
SELECT '2000-04-03'::timestamp - '2000-04-02'::timestamp;

I get:
?column?
----------
23:00
(1 row)

Why april 2nd, 2000 don't last 1 day (or 24 hours) ?

Because April 2nd was the beginning of daylight savings time.

Karl DeBisschop
www.infoplease.com