简体   繁体   中英

Get view projections from information_schema

I have a simple view as following:

CREATE VIEW AS
(
    SELECT identifier AS id FROM persons
);

Does the information_schema views provide functionality to find out that column identifier from table persons is projected as column id in the view?

The view information_schema.view_column_usage only shows that column identifier from persons is used, but not that it is projected into id in the view.

Is there something else I could use from information_schema ?

It is not stored anywhere in information_schema .

Of course it has to be stored somewhere , but that is in the ev_action column of the pg_rewrite system catalog, in the row for the _RETURN rule of the view.

That column has the internal data type pg_node_tree that stores the parsed form of a query, so there is no way to analyze it from SQL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM