Related tables to a view

Поиск
Список
Период
Сортировка
Искать
От
Jan Meyland Andersen
Тема
Related tables to a view
Дата
Msg-id
1404.62.66.218.59.1167083523.squirrel@mail.agile.dk
Список
Дерево обсуждения
Related tables to a view "Jan Meyland Andersen" <jma@agile.dk>
Re: Related tables to a view Michael Fuhr <mike@fuhr.org>
Re: Related tables to a view "Jan Meyland Andersen" <jma@agile.dk>
Re: Related tables to a view "Jim Buttafuoco" <jim@contactbda.com>
Re: Related tables to a view "Jan Meyland Andersen" <jma@agile.dk>
Re: Related tables to a view "Jan Andersen" <jma@agile.dk>
Hi

I need a function which are able to return the underlying tables to a view.

If I have a view which is a selection from field1 and field2 from table1
and field1 and field2 from table2.

How can I make a selection which returns the relation for the fields in a
way so I am able to se which field belongs to which table.

SELECT * FROM pg_views WHERE viewname='TestView' will return the schema
and the definition for me.

SELECT * FROM pg_class WHERE relname = 'TestView' will return some oids etc.

SELECT * FROM pg_attribute JOIN pg_class ON attrelid = pg_class.oid AND
pg_class.relname='TestView' will return the fields including oids etc.

But I just cant find out how to find the tables for each field.

I hope someone are able to help me with this problem.

Regards

Jan Andersen


В списке pgsql-sql по дате отправления
От: Michael Fuhr
Дата:
От: Michael Fuhr
Дата:
Сообщение: Re: Related tables to a view
FAQ