Seq nr | Name | Goal | Type | Data source▲ | Last update | License | ... |
---|---|---|---|---|---|---|---|
641 | Some candidate key values cannot be used as foreign key values | Find foreign key constraints in case of which some candidate key values cannot be used as foreign key values. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-03-10 12:13 | MIT License | |
642 | Some CHECKS are associated with a domain and some with the base table columns that have the domain | Find cases where some CHECKS are associated with a domain and some with the base table columns that have the domain. Avoid duplication of code. Write as little code as possible. If possible, move things "before the brackets" so to say. In this case it means declaring CHECKS at the level of the domain and not at the level of base table columns. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-02-25 17:29 | MIT License | |
643 | Some data modification functions return a value and some not | Find as to whether there are data modification routines that return a value as well as data modification routines that do not return a value. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-11-29 16:47 | MIT License | |
644 | Sometimes regexp_like, sometimes ~ | Find as to whether you sometimes use regexp_like function and sometimes ~ operator. These implement the same functionality. regexp_like function that was added to PostgreSQL 15 and provides the same functionality as ~ and ~* operators. Try to be consistent. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2022-12-13 13:23 | MIT License | |
645 | Sorting rows based on random values in derived tables | Find derived tables (views and materialized views) that sort rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-02-25 17:29 | MIT License | |
646 | Sorting rows based on random values in derived tables without limiting rows | Find derived tables (views and materialized views) that sort rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-02-25 17:30 | MIT License | |
647 | Sorting rows based on random values in routines | Find routines that contain a statement that sorts rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-10-25 16:56 | MIT License | |
648 | Sorting rows based on random values in routines without limiting rows | Find routines that contain a statement that sorts rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-10-25 16:57 | MIT License | |
649 | SQL function does not return a value | Find SQL functions that do not return a value (return VOID) but the SQL statement in the function has RETURNING clause. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-02-27 17:28 | MIT License | |
650 | SQL functions that use optimistic approach for locking but do not return a value | Find SQL functions that use a hidden column of PostgreSQL tables - xmin - to implement optimistic locking but do not return any information to the invoker of the functions, i.e., whether the update/delete operation succeeded or not. The functions should let their invokers know as to whether the function succeeded in updating or deleting a row. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 13:06 | MIT License | |
651 | STATEMENT level triggers and ROW level AFTER triggers without RETURN NULL | Write correct code "The return value of a row-level trigger fired AFTER or a statement-level trigger fired BEFORE or AFTER is always ignored; it might as well be null." (PostgreSQL documentation) | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-02-25 17:30 | MIT License | |
652 | STATEMENT level triggers that refer to the values of row variables NEW or OLD | Find STATEMENT level triggers that refer to the values of row variables NEW or OLD. NEW and OLD are special variables that can only be used in row-level trigger procedures. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-12-20 14:23 | MIT License | |
653 | Stating the obvious | Find database objects that name contains words "data" or "info". These are noise words because databases are meant for storing and manipulating data/information. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-03-17 10:37 | MIT License | |
654 | Stating the obvious (2) | Find the names of database objects where the name of the database object contains a part of the name of the object type. For instance, the query finds base tables, were the name contains fragments _base, base_, _table, or table_. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-11-26 17:04 | MIT License | |
655 | Subqueries of derived tables with LIMIT/FETCH/DISTINCT ON without ORDER BY | Find subqueries of derived tables (views, materialized views) with the LIMIT/FETCH clause or with DISTINCT ON construct but without the ORDER BY clause. These constructs require sorting to produce a meaningful result. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-11-03 16:56 | MIT License | |
656 | Surrogate key columns | Find surrogate keys. Surrogate key is a key that consist of one column, which has an integer type. The key has been declared by using PRIMARY KEY or UNIQUE constraint. The column is associated with a sequence generator (either external or internal, i.e., created by the system automatically because the column has been declared as an identity column). The column does not participate in any foreign key. | General | INFORMATION_SCHEMA+system catalog base tables | 2021-03-07 20:59 | MIT License | |
657 | Surrogate key columns that do not follow the naming style | Find surrogate key columns that name does not end with "id_" or start with "id_". | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-11-16 12:19 | MIT License | |
658 | Table functions with OFFSET | Find table functions that use OFFSET. OFFSET method is a common way for implementing pagination. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2023-11-09 12:13 | MIT License | |
659 | Table has both state and status columns | Find tables that contain both a state and a status column. | General | INFORMATION_SCHEMA+system catalog base tables | 2023-01-14 15:26 | MIT License | |
660 | Table has multiple columns for free-form descriptions | Find tables that contain multiple columns for free-form textual descriptions. Make sure that the names of columns are understandable and sufficiently different. Make sure that there are no duplicate columns. | General | INFORMATION_SCHEMA+system catalog base tables | 2023-01-14 15:36 | MIT License |