selecting all tables with references
От | robert wing |
---|---|
Тема | selecting all tables with references |
Дата | |
Msg-id | CA+3BqY0vR3SsnkvEAKBzGTGFedco1jNqV+ETCu+pjyf9qK0WCw@mail.gmail.com обсуждение исходный текст |
Список | pgsql-novice |
Hello,
Is there a feature in Postgres where we can perform a query that selects all tables that reference a primary key?
For example if I have three tables b.main(k integer primary key, v integer),
b.foo(k integer primary key references b.main(k), v timestamp with time zone),
b.bar(k integer primary key references b.main(k), v timestamp with time zone)
Currently I'm using a cascading type query but was curious if there was way to perform queries using referenced keys.
The psuedo code would look something like: select all tables where b.main.k is referenced.
The results would be rows/columns from b.main,b.foo,and b.bar.
I've searched through the Postgresql documentation, but didn't find the solution I was looking for. Is there way to do this?
I posted this question on stackoverflow as well but received minimal feedback, so thought I would try here as well. If interested the link is http://stackoverflow.com/questions/12808963/select-all-referenced-tables
Thanks,
Robert Wing
Is there a feature in Postgres where we can perform a query that selects all tables that reference a primary key?
For example if I have three tables b.main(k integer primary key, v integer),
b.foo(k integer primary key references b.main(k), v timestamp with time zone),
b.bar(k integer primary key references b.main(k), v timestamp with time zone)
Currently I'm using a cascading type query but was curious if there was way to perform queries using referenced keys.
The psuedo code would look something like: select all tables where b.main.k is referenced.
The results would be rows/columns from b.main,b.foo,and b.bar.
I've searched through the Postgresql documentation, but didn't find the solution I was looking for. Is there way to do this?
I posted this question on stackoverflow as well but received minimal feedback, so thought I would try here as well. If interested the link is http://stackoverflow.com/questions/12808963/select-all-referenced-tables
Thanks,
Robert Wing
В списке pgsql-novice по дате отправления: