Re: regclass without error?

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: regclass without error?
Дата
Msg-id 4D230824.2040309@enterprisedb.com
обсуждение исходный текст
Ответ на Re: regclass without error?  (Tatsuo Ishii <ishii@postgresql.org>)
Ответы Re: regclass without error?  (Tatsuo Ishii <ishii@postgresql.org>)
Список 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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: ALTER EXTENSION UPGRADE patch v1
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Re: new patch of MERGE (merge_204) & a question about duplicated ctid