pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Historical dates in Timestamp
2+ messages / 2 participants
[nested] [flat]

* Historical dates in Timestamp
@ 2001-04-04 11:04 Albert REINER <areiner@tph.tuwien.ac.at>
  2001-04-04 16:36 ` Re: Historical dates in Timestamp Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Albert REINER @ 2001-04-04 11:04 UTC (permalink / raw)
  To: pgsql-sql

Saluton,

I have a database with dates, some of which are historical dates.
When I wanted to enter May 28th, 812 I got an error message, had to
use 0812 for the year instead:

albert=> CREATE DATABASE test;
CREATE DATABASE
albert=> \c test
You are now connected to database test.
test=> CREATE TABLE dates (d timestamp);
CREATE
test=> insert into dates (d) values ('812-5-28');
ERROR:  Bad timestamp external representation '812-5-28'
test=> insert into dates (d) values ('0812-5-28');
INSERT 81801 1

The same happens for BC dates:

test=> insert into dates (d) values ('812-5-28 BC');
ERROR:  Bad timestamp external representation '812-5-28 BC'
test=> insert into dates (d) values ('0812-5-28 BC');
INSERT 81802 1

Is it really reasonable to enforce that the number of years is four
digits at least?

I'm running:

test=> SELECT version();
                              version
--------------------------------------------------------------------
 PostgreSQL 7.0.2 on i586-pc-linux-gnulibc1, compiled by gcc 2.95.1
(1 row)

Bye,

Albert.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Historical dates in Timestamp
  2001-04-04 11:04 Historical dates in Timestamp Albert REINER <areiner@tph.tuwien.ac.at>
@ 2001-04-04 16:36 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-04-04 16:36 UTC (permalink / raw)
  To: Albert REINER <areiner@tph.tuwien.ac.at>; +Cc: pgsql-sql

"Albert REINER" <areiner@tph.tuwien.ac.at> writes:
> Is it really reasonable to enforce that the number of years is four
> digits at least?

I believe so.  Without that cue it's pretty difficult for the timestamp
parser even to figure out which field is intended to be the year, let
alone whether you'd like 1900 or 2000 added to a two-digit year value.

For example, with the default datestyle:

regression=# select '12-5-28'::timestamp;
        ?column?
------------------------
 2028-12-05 00:00:00-05
(1 row)

regression=# select '0012-5-28'::timestamp;
      ?column?
---------------------
 0012-05-28 00:00:00
(1 row)

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-04-04 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-04 11:04 Historical dates in Timestamp Albert REINER <areiner@tph.tuwien.ac.at>
2001-04-04 16:36 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox