postgres and year 2000

From: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
To: hackers(at)postgreSQL(dot)org (PostgreSQL Hackers)
Subject: postgres and year 2000
Date: 1999-01-08 15:53:55
Message-ID: 199901081553.QAA04422@nikita.wizard.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 BC
5|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(at)cs(dot)unitn(dot)it |
| Via Marconi, 141 phone: ++39-0461534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz(at)tango(dot)cs(dot)unitn(dot)it |
+----------------------------------------------------------------------+

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Massimo Dal Zotto 1999-01-08 15:58:34 bug in CREATE USER
Previous Message Massimo Dal Zotto 1999-01-08 15:41:48 bug in libpgtcl listen