Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Querying a parent table's child schemas



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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group