pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: pgsql-sql@postgresql.org
Subject: Suggestion:  Need conversion-testing functions.
Date: Fri, 18 Apr 2003 14:07:33 -0700
Message-ID: <200304181407.33083.josh@agliodbs.com> (raw)

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




Message-ID: <200304181407.33083.josh@agliodbs.com>
Permalink:  ../200304181407.33083.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200304181407.33083.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com
  Subject: Re: Suggestion:  Need conversion-testing functions.
  In-Reply-To: <200304181407.33083.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox