Re: get_whatever_oid, part 1: object types with unqualifed names

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: get_whatever_oid, part 1: object types with unqualifed names
Дата
Msg-id 28922.1277741865@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: get_whatever_oid, part 1: object types with unqualifed names  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: get_whatever_oid, part 1: object types with unqualifed names  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, Jun 28, 2010 at 10:53 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'm not sure I agree that replacing SearchSysCacheExists calls (or
>> things that should have been SearchSysCacheExists calls) with
>> OidIsValid(get_whatever_oid()) is an improvement. �The Exists call
>> tells what you're actually trying to accomplish. �The other way is
>> an overspecification of the required result.

> It is, but on the other hand it's only good fortune that testing
> whether a schema exists is a one-liner even without using
> get_namespace_oid().

True.  Is it worth providing whatever_exists() macros that wrap
get_whatever_oid() like this, just so that callers are a bit clearer as
to what they're doing?  I'm not certain though how many places it could
be used, since many callers probably actually do need the OID, and would
have to write separate lines anyway:
objoid = get_whatever_oid(...);if (!OidIsValid(objoid))    ereport(...);... code using objoid here ...

But it's been useful to have the SearchSysCacheExists functions, even
though they're just wrappers, so maybe whatever_exists() would be worth
its keep.
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Issue: Deprecation of the XML2 module 'xml_is_well_formed' function
Следующее
От: Robert Haas
Дата:
Сообщение: Re: get_whatever_oid, part 1: object types with unqualifed names