Re: regclass without error? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: regclass without error?
Date
Msg-id 22292.1283524289@sss.pgh.pa.us
Whole thread Raw
In response to regclass without error?  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: regclass without error?  ("David E. Wheeler" <david@kineticode.com>)
Re: regclass without error?  (Tatsuo Ishii <ishii@postgresql.org>)
List pgsql-hackers
Tatsuo Ishii <ishii@postgresql.org> writes:
> Is there any way to use regclass without having ERROR?

> pgpool-II needs to find the oid from table name and for the purpose it
> issues something like "SELECT 'table_name'::regproc::oid". Problem is,
> if the table does not exist, an error occured and the transaction
> aborts. Ideally if the table does not exist, the SELECT returns 0
> (InvalidOid).

I don't think the cast should act that way, but I could see providing a
separate conversion function that returns 0 ... or perhaps better NULL
... if no match.
        regards, tom lane


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: regclass without error?
Next
From: Pavel Golub
Date:
Subject: Re: regclass without error?