Suggestion: Need conversion-testing functions. - Mailing list pgsql-sql

From Josh Berkus
Subject Suggestion: Need conversion-testing functions.
Date
Msg-id 200304181407.33083.josh@agliodbs.com
Whole thread Raw
List pgsql-sql
Folks,

A current issue that I am struggling with is that there is no way to test
whether a data type can be cast within a PL/pgSQL function.   If, for
example, I want to test whether a string can be cast into a timestamp, I
cannot do it without raising  an exception, which will then abort my
function.

One would think that isfinite() would allow testing of dates in this way, but
isfinite() returns an exception instead of False if the value passed is an
invalid date.   This makes isfinite(), IMHO, completely useless as a function
-- it doesn't do anything CAST( AS DATE) wouldn't do.

We need "testing functions" for, at a minimum:
text --> date
text --> timestamp
text --> ip address
text --> interval
text --> integer

While I am happy to pay someone to do the necessary coding, I feel strongly
that once these functions are built they should be included in the main set
of builtins.

Comments?  Volunteers?

--
-Josh BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: "Yudie"
Date:
Subject: How to retrieve object definition?
Next
From: Josh Berkus
Date:
Subject: Truly bizarre behavior with VACUUM FULL?