From: | Mike Martin <redtux1(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Return value of CREATE TABLE |
Date: | 2020-09-10 12:06:19 |
Message-ID: | CAOwYNKbLaHe=aeDbzs90ePu1a9ChXtz9yiZyHQ29-_EYu0jB-Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Is this possible?
Basically I want to manage temp table status for use in a procedure.
The procedure looks at pg_catalog to get information for processing.
So basically I would like to be able to know what namespace a temp table is
created in, so that I can constrain lookup.
example
CREATE TEMP TABLE tagdata (test int,test2 numeric(10,2));
SELECT relname,relpersistence ,relnamespace
,pa.atttypid,attname,attnum
,nspname
FROM pg_catalog.pg_class pc
JOIN pg_attribute pa ON pc.oid=pa.attrelid
JOIN pg_namespace pn ON pn.oid=relnamespace
WHERE relname = 'tagdata' AND attnum>0
Which returns (when its run for the second time in different tabs in
pgadmin)
relname persistence namespace typeid colname colnum schema
"tagdata" "p" "2200" "23" "fileid" 1
"public"
"tagdata" "p" "2200" "25" "tagname" 2 "public"
"tagdata" "p" "2200" "1009" "tagvalue" 3 "public"
"tagdata" "t" "483934" "23" "test" 1
"pg_temp_10"
"tagdata" "t" "538079" "23" "test" 1
"pg_temp_13"
"tagdata" "t" "538079" "1700" "test2" 2
"pg_temp_13"
So I would like some way of knowing exactly which schema the temp table has
been created in, I cant see anything obvious
thanks
Mike
From | Date | Subject | |
---|---|---|---|
Next Message | Nicolas Sornin | 2020-09-10 12:13:55 | PG13 partitioned table logical replication |
Previous Message | Abraham, Danny | 2020-09-10 10:43:54 | PKEY getting corrupted |