postgres and year 2000 - Mailing list pgsql-hackers

From Massimo Dal Zotto
Subject postgres and year 2000
Date
Msg-id 199901081553.QAA04422@nikita.wizard.net
Whole thread Raw
List pgsql-hackers
Hi,

it seems that the year handling in pgsql dates is not very consistent:

dz=> create table a (n int, x date);
CREATE
dz=> insert into a values (1,'02-02-0');
INSERT 259246 1
dz=> insert into a values (2,'02-02-00');
INSERT 259247 1
dz=> insert into a values (3,'02-02-000');
INSERT 259248 1
dz=> insert into a values (4,'02-02-0000');
INSERT 259249 1
dz=> insert into a values (5,'02-02-00000');
INSERT 259250 1
dz=> insert into a values (6,'02-02-1');
INSERT 259251 1
dz=> insert into a values (7,'02-02-01');
INSERT 259252 1
dz=> insert into a values (8,'02-02-001');
INSERT 259253 1
dz=> insert into a values (9,'02-02-0001');
INSERT 259254 1
dz=> insert into a values (10,'02-02-00001');
INSERT 259255 1
dz=> insert into a values (11,'02-02-69');
INSERT 259256 1
dz=> insert into a values (12,'02-02-069');
INSERT 259257 1
dz=> insert into a values (13,'02-02-0069');
INSERT 259258 1
dz=> insert into a values (14,'02-02-00069');
INSERT 259259 1
dz=> insert into a values (15,'02-02-71');
INSERT 259260 1
dz=> insert into a values (16,'02-02-071');
INSERT 259261 1
dz=> insert into a values (17,'02-02-0071');
INSERT 259262 1
dz=> insert into a values (18,'02-02-00071');
INSERT 259263 1
dz=> select * from a;n|x            
--+-------------1|02-02-2000   2|02-02-2000   3|02-02-2000   4|02-02-0001 BC5|02-02-2000   6|02-02-2001   7|02-02-2001
8|02-02-2001   9|02-02-0001   
 
10|02-02-2001   
11|02-02-2069   
12|02-02-2069   
13|02-02-0069   
14|02-02-2069   
15|02-02-1971   
16|02-02-1971   
17|02-02-0071   
18|02-02-1971   

The problem I see is that the same number is converted to a different year
depending on the number of digits and the number itself. I think that this
kind of things are the most likely sources of Y2K troubles.
A more consistent approach would be to treat the year literally and let 
any smart hack with dates entirely to the user under his responsability.
Only then we could declare pgsql as full Y2K compliant.

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


pgsql-hackers by date:

Previous
From: Horak Daniel
Date:
Subject: New patches for running PostgreSQL on Windows
Next
From: Massimo Dal Zotto
Date:
Subject: bug in CREATE USER