Re: Bug with timestamp !!!

From: "Eric G(dot) Miller" <egm2(at)jps(dot)net>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Bug with timestamp !!!
Date: 2001-05-13 05:56:51
Message-ID: 20010512225651.A17727@calico.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs pgsql-general

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:

<begin test>
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)
<end test>

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 <egm2(at)jps(dot)net>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2001-05-13 15:27:45 Re: Bug with timestamp !!!
Previous Message Tom Lane 2001-05-13 05:34:51 Re: Re: Bug with timestamp !!!

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-05-13 15:27:45 Re: Bug with timestamp !!!
Previous Message Tom Lane 2001-05-13 05:34:51 Re: Re: Bug with timestamp !!!

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2001-05-13 07:26:42 Re: FTP Problems -- maybe?
Previous Message Ed Loehr 2001-05-13 05:47:55 Re: microsecond log timestamps