From: | "Matthews, James" <jmatthews(at)Railpower(dot)com> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Querying a parent table's child schemas |
Date: | 2007-08-30 13:30:56 |
Message-ID: | 067C9A1F6AFEB643895EA4513E116884BB53ED@exfp1.Railpowertech.local |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-08-30 16:01:14 | Re: Querying a parent table's child schemas |
Previous Message | Michael Glaesemann | 2007-08-29 19:58:05 | Re: using system catalogs |