|
|
Subject: timestamp problem
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 10/31/2007 3:51:55 PM
"Wright, George" <George.Wright@infimatic.com> writes:
> I would expect:
> myhost=> select isfinite(timestamp '2007-10-14 00:00:00 BRST');
> to error out just like:
No, this is intentional behavior. Note the comment in
DetermineTimeZoneOffset:
/*
* It's an invalid or ambiguous time due to timezone transition. Prefer
* the standard-time interpretation.
*/
BTW, isfinite() has got nothing whatever to do with this. If an error
were to be thrown, it would have to be during timestamp value input.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend
Subject: timestamp problem
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 10/31/2007 5:43:01 PM
Michael Glaesemann <grzm@seespotcode.net> writes:
> On Oct 31, 2007, at 12:40 , Wright, George wrote:
>> In the temporal section it mentions
>> Function Returns
>> isfinite(col) BOOLEAN indicating whether col is a valid date.
> I'd argue that this has always been wrong, but my PostgreSQL
> knowledge doesn't extend quite that far back.
Yeah, the definition of the function has always been the same as it is
now: it just checks for the special timestamp values "+infinity" and
"-infinity". If you cross your eyes suitably maybe you could make an
argument that the above description is not incorrect, but I'd agree that
it's not very good.
>> Is there a calendar validation routine in PostGreSQL? I didn't see one
>> in the \df listing.
> Depends on what you mean by calendar validation. For the specific
> case you've been interested in, I doubt it, though you could probably
> cobble one together using a procedural language. Maybe PL/perlu and
> some Perl libraries would help you out.
In the Postgres design, the sort of validation George is interested
in is done by the timestamp datatype's input routine: anything that
has managed to get stored in the database is a valid value, by
definition. So a "validation test" would consist of something like
trying to cast a string to timestamp and seeing if it throws an error.
Unfortunately, there's no provision for "I disagree with this datatype's
validation rules", other than writing your own datatype or hacking the
source code...
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at
http://www.postgresql.org/about/donate
|