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

Re: regclass without error?

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Tatsuo Ishii <ishii(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: regclass without error?
Date: 2011-01-04 11:44:36
Message-ID: 4D230824.2040309@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 04.01.2011 11:07, Tatsuo Ishii wrote:
> Datum
> pgpool_regclass(PG_FUNCTION_ARGS)
> {
> 	char		*pro_name_or_oid = PG_GETARG_CSTRING(0);
> 	Oid	result;
>
> 	PG_TRY();
> 	{
> 		result = DirectFunctionCall1(regclassin,
> 									 CStringGetDatum(pro_name_or_oid));
> 	}
> 	PG_CATCH();
> 	{
> 		result = InvalidOid;
> 	}
> 	PG_END_TRY();
>
> 	PG_RETURN_OID(result);
> }
>
> IMO this implementation is the least invasive but not so
> elegant.

It's not generally safe to suppress errors like that. You could leak 
locks or tuple descriptors etc. And if the error is not "no scuh table", 
but e.g. out of memory, you don't want to suppress it anyway.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2011-01-04 12:04:48
Subject: Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid
Previous:From: Dimitri FontaineDate: 2011-01-04 11:31:55
Subject: ALTER EXTENSION UPGRADE patch v1

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