Goal | Find tables that contain all (or most) of the classifier values and tables that refer to these. |
Notes | The query finds tables that name contains word classifier or lookup and there must be more than one foreign key constraints in other tables that refer to the table. The query uses PostgreSQL system catalog tables not information_schema views in order to give precise answer even if foreign key constraints in different tables have the same name. In SQL a foreign key is an ordered set of columns that must contain at least one column. The query result preserves the order of columns in the key. In case of the string_agg function, the line break (br) tag is used as a part of the separator 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 | Medium (Medium number of false-positive results) |
License | MIT License |
Fixing Suggestion | Create a separate classifier (lookup) table for each classifier type. |
Data Source | system catalog only |
SQL Query |
|
This query belongs to the following collections:
Name | Description |
---|---|
Find problems automatically | Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not . |
This query is classified under the following categories:
Name | Description |
---|---|
Classifier tables | Queries of this category provide information about registration of classifiers. |
Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
Comfortability of data management | Queries of this category provide information about the means that have been used to make the use or management of database more comfortable and thus, more efficient. |
Relationships between tables | Queries of this category provide information about how database tables are connected to each other and whether such connections have been explicitly defined and whether it has been done correctly. |
Further reading and related materials: