agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedClarification on pg_attribute attrelid
2+ messages / 2 participants
[nested] [flat]
* Clarification on pg_attribute attrelid
@ 2020-09-11 11:26 Mike Martin <redtux1@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Mike Martin @ 2020-09-11 11:26 UTC (permalink / raw)
To: pgsql-sql <pgsql-sql@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Clarification on pg_attribute attrelid
@ 2020-09-11 14:12 Tom Lane <tgl@sss.pgh.pa.us>
parent: Mike Martin <redtux1@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2020-09-11 14:12 UTC (permalink / raw)
To: Mike Martin <redtux1@gmail.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-09-11 14:12 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 11:26 Clarification on pg_attribute attrelid Mike Martin <redtux1@gmail.com>
2020-09-11 14:12 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox