Skip site navigation (1) Skip section navigation (2)

Re: regclass without error?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: regclass without error?
Date: 2010-09-03 14:31:29
Message-ID: 22292.1283524289@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Tatsuo Ishii <ishii(at)postgresql(dot)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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-09-03 14:40:54
Subject: Re: plan time of MASSIVE partitioning ...
Previous:From: Pavel GolubDate: 2010-09-03 14:30:19
Subject: Re: regclass without error?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group