On Fri, Sep 3, 2010 at 4:28 AM, Tatsuo Ishii <ishii@postgresql.org> wrote:
> 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).
>
> Any idea?
You can write a query against the system catalog tables. Or you could
install a function that wraps the regclass cast in an exception
handler.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company