Received: from smtp04.mail.onemain.com (SMTP-OUT003.ONEMAIN.COM [63.208.208.73]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4D5uaA57139 for ; Sun, 13 May 2001 01:56:36 -0400 (EDT) (envelope-from egm2@jps.net) Received: (qmail 19734 invoked from network); 13 May 2001 05:56:16 -0000 Received: from unknown (HELO localhost) ([216.119.36.135]) (envelope-sender ) by smtp04.mail.onemain.com (qmail-ldap-1.03) with SMTP for ; 13 May 2001 05:56:16 -0000 Received: from felix by localhost with local (Exim 3.22 #1 (Debian)) id 14yosC-0004dj-00 for ; Sat, 12 May 2001 22:56:56 -0700 Date: Sat, 12 May 2001 22:56:51 -0700 From: "Eric G. Miller" To: PostgreSQL General Subject: Re: Bug with timestamp !!! Message-ID: <20010512225651.A17727@calico.local> Mail-Followup-To: "Eric G. Miller" , PostgreSQL General References: <9dj2rq$1ij$1@news.tht.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.17i In-Reply-To: <9dj2rq$1ij$1@news.tht.net>; from dederer@spb.cityline.ru on Sat, May 12, 2001 at 02:23:30PM +0400 X-Archive-Number: 200105/576 X-Sequence-Number: 9435 On Sat, May 12, 2001 at 02:23:30PM +0400, Alexander Dederer wrote: > Look this: > create table tmp (create_date timestamp); > > #insert into tmp values('2001-04-01 02:29:52'); > INSERT 1021715 1 > > #select * from tmp; > create_data > ------------------------ > 2035-05-29 01:33:36-05 > (1 row) While I don't see such dramatic results with this bad input data, I did run across something a little peculiar: drop table date_test; drop sequence date_test_id_seq; create sequence date_test_id_seq; create table date_test ( id integer default nextval('date_test_id_seq'), ts timestamp, dt datetime ); insert into date_test (ts, dt) values ('2001-04-01 01:01:01','2001-04-01 02:02:02'); insert into date_test (ts, dt) values ('2001-04-01 02:02:02','2001-04-01 01:01:01'); insert into date_test (ts, dt) values ('2001-04-01 02:02:02','2001-04-01 03:03:03'); insert into date_test (ts, dt) values ('2001-04-01 03:03:03','2001-04-01 02:02:02'); select * from date_test; id | ts | dt ----+------------------------+------------------------ 1 | 2001-04-01 01:01:01-08 | 2001-04-01 01:02:02-08 2 | 2001-04-01 01:02:02-08 | 2001-04-01 01:01:01-08 3 | 2001-04-01 01:02:02-08 | 2001-04-01 03:03:03-07 4 | 2001-04-01 03:03:03-07 | 2001-04-01 03:02:02-07 (4 rows) Notice how illegal times in the two o'clock hour are interpreted differently depending on whether the first timestamp occurred before or after the time zone change. The representations are both technically the same, though I think it might lead to problems with date arithmetic later on (I dunno). Daylight savings time should be abolished 8-} -- Eric G. Miller