Thread: Date represetation bug. Some dates are incorrectly selected

Date represetation bug. Some dates are incorrectly selected

From
pgsql-bugs@postgresql.org
Date:
Gianfranco Pesce (g.pesce@hotbrain.it) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Date represetation bug. Some dates are incorrectly selected

Long Description
Some dates are incorrectly selected from pgsql and from the C preprocessor. The same problem arises with JDBC driver.

I have no idea of the meaning of the bug.
If someone have a hint feel free to contact me and I can work to fix the bug. Please see the example code.

The server is a Linux machine with RedHat 6.2

Sample Code
echo $PGDATESTYLE
SQL,EUROPEAN



test=> create table pippo (d date);
CREATE
test=> insert into pippo values ('22/05/1977');
INSERT 629024 1
test=> insert into pippo values ('28/05/1978');
INSERT 629025 1
test=> select * from pippo;
    d
------------
 21/05/1977
 27/05/1978
(2 rows)
test=> select * from pippo where d = '22/05/1977';
    d
------------
 21/05/1977
(1 rows)

From this example code I understand that the error was when
the system converts the date from the internal representation to
the external rapresentation. Please help me. This bug has developed
many troubles to me.



No file was uploaded with this report

Re: Date represetation bug. Some dates are incorrectly selected

From
Tom Lane
Date:
pgsql-bugs@postgresql.org writes:
> test=> create table pippo (d date);
> CREATE
> test=> insert into pippo values ('22/05/1977');
> INSERT 629024 1
> test=> insert into pippo values ('28/05/1978');
> INSERT 629025 1
> test=> select * from pippo;
>     d
> ------------
>  21/05/1977
>  27/05/1978
> (2 rows)
> test=> select * from pippo where d = '22/05/1977';
>     d
> ------------
>  21/05/1977
> (1 rows)

Hm. Are these dates daylight-savings-time transition dates in your
timezone?  If so, this is probably a known bug that has been fixed
in more recent Postgres releases.  (RedHat 6.2 ships with Postgres
6.5.something if I recall correctly.  I suggest updating to PG 7.0.3.)

            regards, tom lane