Proposal for Clean-up of Conversion Functions

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Proposal for Clean-up of Conversion Functions
Date: 2002-09-29 20:38:14
Message-ID: 200209291338.14479.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Postgres Folks,

As long as we're talking about the ToDo list, I'd like to make some simple
proposals regarding Postgres' conversion functions.

1) Addition of remaing to_char functions: We should add to_char functions for
the following datatypes:
to_char(interval, 'format string') (I believe this is already in the todo)
to_char(inet, 'format string')

2) Addition of the following to-datatype conversion functions:
to_inet(text, optional 'format string')
to_interval(text, optional 'format string')
to_time(text, optional 'format string')
Without the "format string" these functions would operate like the current
"Interval" and "time" functions, but not require quoting the function name.

3) Addition of datatype testing functions. All of these functions would test
whether a text value is CASTable or transformable as the specific datatype
and return a boolean value *without* raising an exception. The absence of
analogous functions is one of many issues holding back PL/pgSQL from PL/SQL
parity, as data type validation must take place outside functions.

is_timestamp(text, optional 'format string')
is_interval(text, optional 'format string')
is_time(text, optional 'format string')
is_date(text, optional 'format string')
is_inet(text, optional 'format string')
is_number(text, optional 'format string')

--
-Josh Berkus
Aglio Database Solutions
San Francisco

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-09-29 20:38:37 Re: [SQL] CURRENT_TIMESTAMP
Previous Message Josh Berkus 2002-09-29 19:43:45 Re: [SQL] CURRENT_TIMESTAMP