| 901 |
Different foreign key column names in case of referencing the same candidate key |
Find the cases when the names of columns in different foreign keys that reference to the same candidate key are different. If different names reflect different roles, then it is legitimate. However, there could also be accidental differences that makes it more difficult to use the database. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 902 |
Different prefixes of a candidate key column and a referencing foreign key column |
The naming must be consistent. Find foreign key constraints where the candidate key column and foreign key column names have different prefixes. Thus, for instance, one cannot use USING syntax for joining the tables. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 903 |
Different suffixes of a candidate key column and a referencing foreign key column |
This query identifies naming inconsistencies in foreign key relationships by comparing the suffixes of foreign key columns against their referenced candidate key columns. It flags pairs where the suffixes diverge (e.g., referencing user_id via a column named user_code or user_ref). Such discrepancies prevent the use of the simplified ANSI SQL USING syntax for joins, forcing the use of explicit ON clauses. The goal is to enforce a standardized suffix convention (typically _id) across the schema to improve maintainability and query readability. |
Problem detection |
system catalog base tables only |
2025-12-14 11:43 |
MIT License |
View |
| 904 |
Different tasks of rules |
Find different tasks that are solved by using rules, i.e., different rules on the same table or different tables that do the same thing are considered to solve one task. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 905 |
Disabled rules |
Identify disabled rules. These should be enabled or dropped, otherwise these are dead code. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 906 |
Disabled system triggers (i.e., disabled enforcement of constraints) |
These triggers should be enabled because otherwise some important functionality regarding constraints like enforcing referential integrity does not work. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 907 |
Disabled user triggers |
Identify disabled triggers. These should be enabled or dropped, otherwise these are dead code. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 908 |
Do not always depend on one's parent |
Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 909 |
Do not always depend on one's parent - column names are ot sufficiently different |
Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four). |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 910 |
Do not leave out the referential constraints (islands) |
Try to find missing foreign key constraints. Find base tables that do not participate in any referential constraint (as the referenced table or as the referencing table). These tables are like "islands" in the database schema. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 911 |
Duplicate foreign key constraints |
Find duplicate foreign key constraints, which involve the same columns and refer to the same set of columns. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 912 |
Duplicate independent (i.e., not created based on a table) composite types |
Find composite types with the same attributes (regardless of the order of attributes). Make sure that there is no duplication. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 913 |
Duplicate keys |
Find completely overlapping key (primary key, unique, and exclude where all operators are =) constraints. This is a form of duplication. It leads to the creation of multiple indexes to the same set of columns. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 914 |
Duplicate materialized views |
Find materialized views with exactly the same subquery. There should not be multiple materialized views with the same subquery. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 915 |
Duplicate non-fuction based unique indexes |
Find pairs of non-function based unique indexes that cover the same set of columns. Include indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration. For instance, it helps us to find unique indexes that have been defined to already unique columns. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 916 |
Duplicate rules |
Find multiple rules with the same definition (event, condition, action) on the same table. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 917 |
Empty tables |
Find base tables where the number of rows is zero. If there are no rows in a table, then it may mean that one hasn't tested constraints that have been declared to the table or implemented by using triggers. It could also mean that the table is not needed because there is no data that should be registered in the table. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 918 |
Excessive privileges on databases, schemas, domains, types, languages, foreign data wrappers, and foreign servers |
Find excessive privileges on databases, schemas, domains, collations, sequences, foreign data wrappers, and foreign servers that are probably not needed by a typical application. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 919 |
Exclude constraint instead of simple UNIQUE |
Find exclude constraints that implement a simple UNIQUE constraint. The checking might be slower compared to UNIQUE constraint. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 920 |
Extension routines |
Find all routines that belong to an extension. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |