Re: Bug in date arithmetic

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug in date arithmetic
Date: 2009-08-24 17:18:46
Message-ID: 15012.1251134326@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> ... I'm not sure why it's complaining about field overflow
> rather than syntax error when the literal is taken as a timestamp,
> but that's a pretty minor issue.

Oh, of course, it's because we allow this shorthand:

regression=# select '900102'::timestamptz;
timestamptz
------------------------
1990-01-02 00:00:00-05
(1 row)

so '900000'::timestamptz is seen as year (19)90, month 00, day 00,
and "field out of range" is entirely sensible for that.

Just out of curiosity, what were you *expecting* this to do?
You obviously weren't expecting the literal to be taken as
interval, but its contents are not very sane for any other
likely interpretation.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-08-24 17:25:32 Re: 8.5 release timetable, again
Previous Message Robert Haas 2009-08-24 17:18:27 Re: DELETE syntax on JOINS