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...
701Insufficient number of user-defined non-trigger routinesThere must be at least n (four in this case) user-defined non-trigger routines in the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
702Insufficient number of user-defined viewsThere must be at least n (four in this case) user-defined views in the database.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
703JSON type instead of JSONB type"In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys." (https://www.postgresql.org/docs/current/datatype-json.html)Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
704LIKE without a pattern with % or _Find expressions that use LIKE predicate witout a pattern that contains at least one % or _ sign.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
705Names of columns that hold personal names but do not take into account cultural diversityFind columns of tables (base tables, views, materialized views, foreign tables) that have the name first_name or last_name. Such column names do not take into account that different cultures use different personal name components and the number of possible components is more than two. If in a culture, the surname is presented before the given name, then the column names causes confusion.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
706NOT IN or <> ALL in derived tablesAvoid using NOT IN or <>ALL with a non-correlated subquery in PostgreSQL because the query performance will be very poor, especially in case of large data sizes.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
707NOT VALID foreign key constraintsFind not valid foreign key constraints. These constraints have been created so that the existing data has not been checked against the constraint. It could be deliberate in case of legacy systems that have data quality problems. However, ideally all the data in the table conforms to the constraint.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
708Only one value permitted in a base table or a foreign table column (based on enumeration types)Find columns of base tables or foreign tables in case of which the type of the column permits only one value in the column. The type is an enumeration type that specifies only one value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
709Perhaps incorrect WHEN clauseFind row level triggers that have action condition (WHEN clause) but the Boolean expression in its specifications does not refer to neither NEW nor OLD variable.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
710Perhaps the type of a base table column/domain should be BOOLEAN (based on types and default values)Find base table columns and domains that have a textual type and the default value that represents a truth-value. For instance, the type of a column could be VARCHAR and the column has the default value 'TRUE'.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
711Perhaps the type of a base table column/domain should be temporal (based on default values)Find base table columns and domains that have a textual type but the default value that represents a temporal value (either a static value or invocation of a function that returns such value). Specify for each column/domain a right data type that takes into account expected values in the column/domain.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
712Perhaps the type of a base table column should be BOOLEAN (based on enumerated types)Find base table columns that have an enumerated type that seems to emulate Boolean type.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
713Publications with no tablesFind publications that do not contain any table.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
714Recursive relationships with the same source and targetFind incorrectly implemented adjacency lists.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
715Recursive triggers that directly modify their home tableDo not cause potentially infinite loops. Recursive trigger fire themselves over and over again. If the system is not able to stop these, then it eventually consumes all the resources of the system. Although the system is able to detect these it is better to avoid creating these altogether.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
716Reference to the numeric type is too imprecise, i.e., precision and scale are missingFind base table columns that have the DECIMAL/NUMERIC type, but do not have precision and scale specified. "Specifying: NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale."Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
717ROW-level BEFORE and INSTEAD OF triggers with RETURN NULLSuch triggers effectively cancel data modification. It might be correct but could also be a mistake. "Row-level triggers fired BEFORE can return null to signal the trigger manager to skip the rest of the operation for this row (i.e., subsequent triggers are not fired, and the INSERT/UPDATE/DELETE does not occur for this row). " (PostgreSQL documentation) "INSTEAD OF triggers (which are always row-level triggers, and may only be used on views) can return null to signal that they did not perform any updates, and that the rest of the operation for this row should be skipped (i.e., subsequent triggers are not fired, and the row is not counted in the rows-affected status for the surrounding INSERT/UPDATE/DELETE). " (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
718ROW level BEFORE triggers with RAISE EXCEPTION but without RETURN NULLAlthough RAISE EXCEPTION stops the execution it would be a good style to still return. In this case the return should bring back NULL, i.e., the row will not be processed furtherProblem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
719Rules with the same name within the same schemaFind names of rules that are used within the same schema more than once. Give different triggers different names.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
720SET DEFAULT compensatory action is unsuitableFind foreign keys with SET DEFAULT compensatory action where the foreign key column does not have a default value. Compensatory actions cannot make changes that violate integrity constraints in a database. SET DEFAULT means that there shoud be a default value at the foreign key column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License