Обсуждение: Clarification on pg_attribute attrelid

Поиск
Список
Период
Сортировка

Clarification on pg_attribute attrelid

От
Mike Martin
Дата:
Is it correct that calling attrelid::regclass will always return a non-schema qualified relation name
ie:
WHERE there is a temp table and a permanent table of the the same name
SELECT attrelid::regclass
FROM pg_attribute
WHERE attrelid = 'tagdata'::regclass

will always use the "current" temp table of the name or the permanent table  if no temp table exists without schema qualification.

So this would be the same as a normal select , ie:uses temp table/permanent table as appropriate

thanks

Mike

Re: Clarification on pg_attribute attrelid

От
Tom Lane
Дата:
Mike Martin <redtux1@gmail.com> writes:
> Is it correct that calling attrelid::regclass will always return a
> non-schema qualified relation name

No.  regclassout will schema-qualify if the table isn't visible
according to the current search path.

I didn't check, but I think "not visible" would include the case
of "table is hidden by a temp table of the same name".

            regards, tom lane