I have the following table named reports
:
report_code PK VARCHAR 5
report_sql TEXT
The report_sql stores the sql code that generates a report. The sql code is in postgresql flavor. So from that table I want to search all the records that on the sql code use views and materialized views that are generated from specific tables.
The views, the materialized views the tables that generated from and the table reports
is in the same database server.