Querying a parent table's child schemas

Поиск
Список
Период
Сортировка
От Matthews, James
Тема Querying a parent table's child schemas
Дата
Msg-id 067C9A1F6AFEB643895EA4513E116884BB53ED@exfp1.Railpowertech.local
обсуждение исходный текст
Ответы Re: Querying a parent table's child schemas  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice

Greetings all,

      I was wondering if there was a way to SELECT from a parent table and display the schema associated with a child table’s data.  There’s the general idea now let me explain further…  I have a parent table called alarms, whenever a new user uploads any alarms to the database a schema is created which inherits the attributes of the public alarms table (the different schemas allow me to keep track of who uploaded what).  In this way, I am able to look through all the alarms by querying public.alarms as well as query each individual schema’s alarms table.  What I want to do however, is let’s say perform a query like:

 

SELECT date, time, alarm_code, alarm_msg, child_schema() FROM public.alarms;

 

I know there is a command current_schema(), but when querying the public.alarms table I only get the public schema, and not the schema of the associated children tables.

 

Does anybody know if this is even possible?  If so any information or tips would be greatly appreciated.

 

Thanks in advance,

 

James L. Matthews

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: using system catalogs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Querying a parent table's child schemas