Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8BDEA475C3D for ; Sun, 29 Sep 2002 16:36:25 -0400 (EDT) Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id B427D475AAC for ; Sun, 29 Sep 2002 16:36:23 -0400 (EDT) Received: from [66.219.92.2] (HELO chocolate-mousse) by davinci.ethosmedia.com (CommuniGate Pro SMTP 3.5.9) with ESMTP id 1733858 for pgsql-sql@postgresql.org; Sun, 29 Sep 2002 13:36:42 -0700 Content-Type: text/plain; charset="us-ascii" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-sql@postgresql.org Subject: Proposal for Clean-up of Conversion Functions Date: Sun, 29 Sep 2002 13:38:14 -0700 X-Mailer: KMail [version 1.4] MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200209291338.14479.josh@agliodbs.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/406 X-Sequence-Number: 9683 Postgres Folks, As long as we're talking about the ToDo list, I'd like to make some simple= =20 proposals regarding Postgres' conversion functions. 1) Addition of remaing to_char functions: We should add to_char functions = for=20 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= =20 "Interval" and "time" functions, but not require quoting the function name. 3) Addition of datatype testing functions. All of these functions would te= st=20 whether a text value is CASTable or transformable as the specific datatype= =20 and return a boolean value *without* raising an exception. The absence of= =20 analogous functions is one of many issues holding back PL/pgSQL from PL/SQL= =20 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') --=20 -Josh Berkus Aglio Database Solutions San Francisco