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 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-01-04 12:04:48 | Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid |
Previous Message | Dimitri Fontaine | 2011-01-04 11:31:55 | ALTER EXTENSION UPGRADE patch v1 |