Catalog of PostgreSQL queries for finding information about a PostgreSQL database and its design problems

AND
AND
AND
ANDFrom where does the query gets its information?
AND
AND

There are 961 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
401Foreign key columns that are associated with a sequence generatorFind foreign key columns that are associated with a sequence generator. Foreign key values are selected amongst the values that are registered as corresponding primary key/unique key values. Values in the foreign key columns are not directly generated by the system. These values might be system generated indirectly - generated when a row is added to the primary (parent) table.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:42MIT License
402Foreign key column has a simple check constraint that is attached directly to the tableFind foreign key columns that are covered by a simple check constraint, i.e., the constraint involves only one column. Look only constraints that are directly associated with the table, i.e., are not specified through a domain. Perhaps the constraint should be defined on the referenced candidate key column.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
403Foreign key columns that have no indexFind foreign key columns that do not have an index. Foreign key columns are often used for performing join operations. It is useful to index such columns.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
404Foreign key columns that do not have an integer or varchar typeFind foreign key columns that do not have smallint, integer, bigint, or varchar(n) type. These are the most commonly used types in case of key/foreign key columns. Although the use of other types would be perfectly legal as well, make sure that you have selected the best possible data type for each and every column.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-16 10:14MIT License
405Optional foreign key columnsFind foreign key columns that do not have the NOT NULL constraint. It is better to limit the use of NULLs and optional columns due to the problems that it causes in interpreting the query results, making queries, and enforcing constraints. In addition, one should check as to whether this kind of design is consistent with the multiplicities in the conceptual data model.GeneralINFORMATION_SCHEMA only2023-11-17 18:36MIT License
406Foreign key column has a default value that is not present in the parent tableFind foreign key columns that have a default value that is not present in the parent table. Identify default values that cause violations of the referential constraints.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
407Gratuitous context in the names of foreign key columnsFind foreign key columns that name contains twice the name of the referenced (primary) table.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
408Too generic names (foreign key columns)Find foreign key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix that describes the nature of relationship with the referenced table or at least referes to the referenced table. These are too generic names.Problem detectionsystem catalog base tables only2023-01-20 12:37MIT License
409Some candidate key values cannot be used as foreign key valuesFind 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 detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:13MIT License
410Inconsistent use of plural and singular in table names in the context of a relationship (English version)Find foreign key constraints in case of which the name of one of the tables is in plural and the name of another table is in singular.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-13 13:41MIT License
411Inconsistent use of plural and singular in table names in the context of a relationship (Estonian version)Find foreign key constraints in case of which the name of one of the tables is in plural and the name of another table is in singular.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-13 14:21MIT License
412ON DELETE CASCADE is probably missing (based on the multiplicity of the relationship)Find foreign key constraints that completely overlap with a candidate key constraint (primary key or unique constraint) but the foreign key constraint does not have the ON DELETE CASCADE compensating action. In this case there is a foreign key that implements a relationship type between a strong entity type and a weak entity type (1-1 relationship type). Therefore, in this case ON DELETE CASCADE is an appropriate compensating action.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
413Inconsistent use of plural and singular in column names in the context of a relationship (English version)Find foreign key constraints that cover one column in case of which the name of refererenced/referencing column is in plural and the name of referencing/refererenced column is in singular.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-13 14:14MIT License
414ON UPDATE CASCADE is probably missing (based on column names)Find foreign key constraints that do not feature ON UPDATE CASCADE compensating action although people have a reason to change the key value in the primary table by assuming that the names of foreign key columns correctly point towards the use of natural keys in the table.Problem detectionsystem catalog base tables only2023-11-16 11:59MIT License
415ON DELETE CASCADE is probably not needed (based on the relationship type)Find foreign key constraints that implement a non-identifying relationship type and have ON DELETE CASCADE compensating action. If the identity of the parent table is not a part of the identity of the child table, then there is a non-identifying relationship type and most probably the foreign key should not have ON DELETE CASCADE.Problem detectionsystem catalog base tables only2023-10-28 18:38MIT License
416Foreign key references a non-key (has optional columns)Find foreign key constraints that referenced column is optional.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:12MIT License
417ON UPDATE CASCADE is not needed (based on surrogate keys)Find foreign key constraints that reference to a candidate key that is a surrogate key, i.e., its values are generated by the system by using sequence generators. Do not use ON UPDATE CASCADE in case of foreign keys that reference to surrogate keys.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-04-30 18:39MIT License
418Foreign key constraint references to the columns of a UNIQUE constraint not to the columns of the PRIMARY KEY constraintFind foreign key constraints that reference to a UNIQUE constraint columns not to the PRIMARY KEY constraint columns. This is legal in SQL. However, a tradition is to refer to the primary key columns. If most of the foreign keys refer to the primary key columns, then it raises a question as to whether this kind of design decision has a good reason in a particular case or whether it is an inconsistency.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
419Foreign key constraint references to the columns of a UNIQUE constraint not to the columns of the PRIMARY KEY constraint while the referenced table has the primary keyFind foreign key constraints that reference to a UNIQUE constraint columns not to the PRIMARY KEY constraint columns while at the same time the referenced table does have the primary key. This is legal in SQL. However, a tradition is to refer to the primary key columns. If most of the foreign keys refer to the primary key columns, then it raises a question as to whether this kind of design decision has a good reason in a particular case or whether it is an inconsistency.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
420Foreign key references to a unique index columns not a unique key columnsFind foreign key constraints that reference to the columns that are covered by a unique index not a unique key.Problem detectionsystem catalog base tables only2022-10-21 10:30MIT License