The following bug has been logged online:
Bug reference: 2768
Logged by: Mikko Tiihonen
Email address: mikko.tiihonen@iki.fi
PostgreSQL version: 8.1.5
Operating system: Linux/amd64/gcc-4.1.1
Description: dates before year 1600 in timestamptz column give
strange results
Details:
createuser -s -d test
createdb -E LATIN9 -O test test
psql -U test
---
CREATE TEMP TABLE tester (stamp timestamp(6) with time zone);
INSERT INTO tester (stamp) VALUES ( '0134-05-06 09:12:34.123456 +0200' );
INSERT INTO tester (stamp) VALUES ( '2134-05-06 09:12:34.123456 +0200' );
SELECT * FROM tester;
---
PostgreSQL compiled with intdatetime=on
stamp
----------------------------------
0134-05-06 08:52:26.123456+01:39
2134-05-06 09:12:34.123456+02
(2 rows)
PostgreSQL compiled with intdatetime=off
stamp
----------------------------------
0134-05-06 08:52:26.123459+01:39
2134-05-06 09:12:34.123456+02
(2 rows)
If I fetch the rows using v3 protocol with and binary encoding for the
timestamp field I get back has the correct time. If I fetch the rows using
text encoding I get the same erronous value as with psql.
That makes me think the problem is in converting the internal timestamptz
format to formatted text.