Suggestion: Need conversion-testing functions.

Поиск
Список
Период
Сортировка
Искать

Suggestion: Need conversion-testing functions.

От:
Josh Berkus <josh@agliodbs.com>
Дата:
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


FAQ