Goal | Find derived tables (views and materialized views) that present data from one base table without adding columns, renaming columns, changing the order of columns, removing columns, or restricting rows. Perhaps something is missing from the subquery of the derived table. |
Notes | The query uses a fragment of a query from: https://www.cybertec-postgresql.com/en/tracking-view-dependencies-in-postgresql/. The query could give false positive results. If in the base table are no declared key constraints, i.e., there could be repeating rows and the subquery of the derived tables removes repeating rows, then the base table and derived tables do not contain the same data. In the returned body of view/materialized view the query replaces each newline character with the line break (br) tag for the better readability in case the query result is displayed in a web browser. In the list of table columns the separator is the line break (br) tag for the better readability in case the query result is displayed in a web browser. |
Type | Problem detection (Each row in the result could represent a flaw in the design) |
Reliability | Low (Many false-positive results) |
License | MIT License |
Data Source | INFORMATION_SCHEMA+system catalog |
SQL Query |
|
This query is classified under the following categories:
Name | Description |
---|---|
Derived tables | Queries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer. |
Further reading and related materials:
Reference |
---|
https://www.cybertec-postgresql.com/en/tracking-view-dependencies-in-postgresql/ |
Rule 10 in: Delplanque, J., Etien, A., Auverlot, O., Mens, T., Anquetil, N., Ducasse, S.: CodeCritics applied to database schema: Challenges and first results. In: 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 432-436. IEEE, (2017). |