Re: What happened to the is_<type> family of functions proposal?

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Colin 't Hart" <colinthart(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: What happened to the is_<type> family of functions proposal?
Date: 2010-09-21 15:56:51
Message-ID: AANLkTi=QPvSTT75UcEi7R7U=0mUbOfMSo_aV7fGWD_os@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 21, 2010 at 11:49 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> I think it would be useful to have a way of testing whether a cast to
>> a given type will succeed.  The biggest problem with the
>> exception-catching method is not that it requires writing a function
>> (which, IMHO, is no big deal) but that exception handling is pretty
>> slow and inefficient.  You end up doing things like... write a regexp
>> to see whether the data is in approximately the right format and then
>> if it is try the cast inside an exception block.  Yuck.
>
> The problem here is that putting the exception handling in C doesn't
> make things any better: it's still slow and inefficient.  And in the
> general case the only way to be sure that a string will be accepted by
> the input function is to try it.

Given the current API, that is true.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-09-21 15:59:01 Re: bg worker: general purpose requirements
Previous Message Tom Lane 2010-09-21 15:49:56 Re: What happened to the is_<type> family of functions proposal?