pg_temp 101 question

Поиск
Список
Период
Сортировка
От Konstantin Izmailov
Тема pg_temp 101 question
Дата
Msg-id AANLkTi=Kz_EiwXezOZAjr9-v6_Rd=J+nq3z=nBWdkSKd@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_temp 101 question
Список pgsql-general
My application creates/uses a temporary table "X" via multiple
connections at the same time. Is there a way to determine which
pg_temp_N belongs to the current connection?

I need this to obtain list of attributes for the temporary table...
All connections are using the same temp table name (by design made
long time ago for another DB). So if I query:
select T.schemaname, T.tablename, A.attname, A.atttypid, TY.typname, D.adsrc
from pg_attribute A
inner join pg_class C on (A.attrelid=C.oid)
inner join pg_tables T on (C.relname=T.tablename)
inner join pg_namespace NS on (NS.oid=C.relnamespace and
NS.nspname=T.schemaname)
inner join pg_type TY on (TY.oid=A.atttypid)
left outer join pg_attrdef D on (D.adrelid=C.oid and D.adnum=A.attnum)
where A.attnum>0 and A.attisdropped='f' and T.schemaname like
'pg_temp%' and T.tablename='X'

it returns list of all columns in all temporary tables. I just need
columns list for temp table for the current connection.

Thank you!

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Shit happens
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_temp 101 question