Clarification on pg_attribute attrelid

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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
Reply | Threaded
Open this post in threaded view
|

Re: Clarification on pg_attribute attrelid

Tom Lane-2
Mike Martin <[hidden email]> 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