Re: Exposed function to find table in schema search list?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Exposed function to find table in schema search list?
Дата
Msg-id 12824.1022261594@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Exposed function to find table in schema search list?  ("Joel Burton" <joel@joelburton.com>)
Ответы Re: Exposed function to find table in schema search list?  ("Joel Burton" <joel@joelburton.com>)
Список pgsql-hackers
"Joel Burton" <joel@joelburton.com> writes:
> Well, sort of, but if we had been promoting a function tableoid(text)
> returns oid, we wouldn't have to make any change for the move to regclass,
> would we? I mean, it's specific to PG, but a simple wrapper might outlive
> the next under-the-hood change.

I think you miss the point: regclass is that wrapper.  tableoid(text)
is only syntactically different --- and for that matter there's nothing
stopping you from writing regclass('tablename').

> On a related note: is there an easy way to use this ::regclass conversion to
> test if a table exists in a non-error returning way? (Can I use it in a
> select statement, for instance, returning a true or false value for the
> existence or non-existence of a table?)

At the moment regclass conversion raises an error if the item isn't
found; this follows the historical behavior of regproc.  We could
possibly have it return 0 (InvalidOid) instead, but I'm not convinced
that that's better.  In the case of regproc, not erroring out would
lose some important error checking during initdb.
        regards, tom lane


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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Redhat 7.3 time manipulation bug
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Redhat 7.3 time manipulation bug