Re: Behavior of pg_catalog dependent on search_path: expected or bug?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Behavior of pg_catalog dependent on search_path: expected or bug?
Дата
Msg-id CAKFQuwar9sQqgL+8RUkgkQSe+ajCkvxvgkhvx07ZqRt_edAXNw@mail.gmail.com
обсуждение исходный текст
Ответ на Behavior of pg_catalog dependent on search_path: expected or bug?  ("ldh@laurent-hasson.com" <ldh@laurent-hasson.com>)
Список pgsql-bugs
On Sat, Feb 4, 2023 at 9:38 PM ldh@laurent-hasson.com <ldh@laurent-hasson.com> wrote:

 

This script worked the first time but then failed on reruns. After some investigation, I noticed that this was run as part of a larger script and a “search_path” was set. I was able to isolate a behavior that I am not able to understand, i.e., bug or expected behavior?

 

The code below fails:

 

SET search_path TO XXX;

select p.oid::regprocedure

  from pg_catalog.pg_proc p

  join pg_catalog.pg_namespace n on p.pronamespace = n.oid

 where p.oid::regprocedure::text='sample(anyelement)'

   and n.nspname = 'public'


Working as documented:


"The reg<...> input converter handles the <...> lookup according to the schema path setting, and so it does the “right thing” automatically."

and, more pertinent to your example:

"All of the OID alias types for objects that are grouped by namespace accept schema-qualified names, and will display schema-qualified names on output if the object would not be found in the current search path without being qualified."

Thus what is really failing is your attempt to compare the text cast result in the where clause to a non-schema qualified procedure named sample(anyelement).

David J.

P.S. Please provide the behavior you observe and why you think it is incorrect in future reports, don't just say "it fails", there are many ways in which things can fail.
P.P.S. This mailing list is the bug system so you've already entered the details.

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

Предыдущее
От: "ldh@laurent-hasson.com"
Дата:
Сообщение: Behavior of pg_catalog dependent on search_path: expected or bug?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Behavior of pg_catalog dependent on search_path: expected or bug?