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