Re: timestamp problem - Mailing list pgsql-novice

From Tom Lane
Subject Re: timestamp problem
Date
Msg-id 21231.1193866981@sss.pgh.pa.us
Whole thread Raw
In response to Re: timestamp problem  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-novice
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

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: timestamp problem
Next
From: "Phillip Smith"
Date:
Subject: Re: What data type best used for money