Suggestion: Need conversion-testing functions.

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Suggestion: Need conversion-testing functions.
Date: 2003-04-18 21:07:33
Message-ID: 200304181407.33083.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Berkus
Aglio Database Solutions
San Francisco

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-04-18 22:25:59 Truly bizarre behavior with VACUUM FULL?
Previous Message Yudie 2003-04-18 20:57:32 How to retrieve object definition?