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...
61Perhaps incorrect default valeFind columns of base tables that have default value CURRENT_USER.Problem detectionINFORMATION_SCHEMA only2023-12-30 11:32MIT License
62Incorrect data type (based on default values)Find columns of base tables that have the default value CURRENT_USER or SESSION_USER but the data type is CHAR or TEXT.Problem detectionINFORMATION_SCHEMA only2023-12-30 11:06MIT License
63Incorrect field size (based on default values)Find columns of base tables that have the default value CURRENT_USER or SESSION_USER but the field size is not 63 (default maximum identifier length in PostgreSQL).Problem detectionINFORMATION_SCHEMA only2023-12-30 11:05MIT License
64Do not format comma-separated lists (based on default values)Find, based on default values, cases where a multi-valued attribute in a conceptual data model is implemented as a textual column of a base table or a foreign table. Expected values in the column are strings that contain attribute values, separated by commas or other separation characters.Problem detectionINFORMATION_SCHEMA only2023-12-30 10:59MIT License
65Perhaps the type of a base table column/domain should be numeric (based on default values)Specify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that have a textual type but the default value that represents a number (for instance, '100', '2', or '0.22'). Exclude columns about formats.Problem detectionINFORMATION_SCHEMA only2023-12-30 10:59MIT License
66Do not leave out the referential constraints (based on column names) (2)Try to find missing foreign key constraints. Find columns of base tables that are not a part of any primary key, unique, and foreign key constraint, but have a name that reffers to the possibility that these are used to record references to a user. Exclude columns that have the default value CURRENT_USER or SESSION_USER.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 10:29MIT License
67Perhaps unnecessary DECLARE section in a PL/pgSQL routineFind PL/pgSQL routines that perhaps unnecessarily contain DECLARE section. More specifically, find routines with the DECLARE section where the only task seems to be raising an exception. The query excludes the cases where the error message is constructed dynamically, i.e., in this case using a variable maybe justifiable.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 10:19MIT License
68CHECK constraints on columns with personal namesFind CHECK constraints on base table or foreign table columns that contain data about personal names. Make sure that the constraints do not restrict registration of legal names.GeneralINFORMATION_SCHEMA only2023-12-25 12:51MIT License
69CHECK constraints with the cardinality bigger than one that involve the same set of columnsCHECK constraints with the cardinality bigger than one that involve the same set of columns. Make sure that there is no duplication.Generalsystem catalog base tables only2023-12-25 12:39MIT License
70CHECK constraints with the cardinality bigger than oneFind multicolumn CHECK constraints. Such constraints must be associated directly with a base table, i.e., these cannot be associated with a domain. Enforce as much data integrity as possible at the database level and prefer declarative constraints to a trigger.Generalsystem catalog base tables only2023-12-25 12:38MIT License
71CHECK constraints on columns with temporal dataIf your table contains columns with temporal data, then it will be appropriate to restrict the range of possible values in these columns because some of the values that belong to the type might not be appropriate (for instance, imagine a client who was born in 1100-12-03 or a contract that was registered in 3890-12-12- 12:45). If your table contains multiple columns with temporal data that denote events, then the rule about the order of the events must be enforced, if possible.GeneralINFORMATION_SCHEMA only2023-12-25 12:37MIT License
72Derived table presents the same data in the same way as a single base tableFind derived tables (views and materialized views) that present data from one base table without adding columns, renaming columns, changing the order of columns, removing columns, or restricting rows. Perhaps something is missing from the subquery of the derived table.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-25 12:15MIT License
73A large number of triggersShow user-defined triggers if there are more than 9 different trigger routine bodies, i.e., different triggers on different tables that do the same thing count as one trigger.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-25 11:23MIT License
74Routine body has keywords that are not in uppercaseKeywords in uppercase improve readability.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-24 17:06MIT License
75Duplicate specification of character classesFind regular expressions where within the same specification of a character class the character class alnum as well as 0-9, \d, A-Z, or a-z has been defined.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-24 10:43MIT License
76Perhaps unnecessary DECLARE section in a PL/pgSQL routine (2)Find PL/pgSQL routines that perhaps unnecessarily contain DECLARE section. More specifically, find routines with the DECLARE section where the keyword DECLARE is followed by BEGIN, i.e., the DECLARE section is empty.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-23 13:39MIT License
77Invocation of a system-defined routine without providing any argumentsFind user-defined routines that contain an invocation of a system-defined function without providing any argument. The query considers all aggregate functions as well as some popular scalar functions.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-22 13:00MIT License
78Columns with tsvector typeFind columns of base tables and materialized views that have tsvector type.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-22 12:41MIT License
79Data type usage in the base table columnsGet overview of used data types in the columns of base tables. If the selection is very small then this is a warning sign that perhaps unsuitable types have been used.GeneralINFORMATION_SCHEMA only2023-12-22 12:39MIT License
80Prefixes in the names of database objectsFind for different types of database objects all the prefixes that are used in different names. One should be consistent in naming, including in the use of prefixes. If you use prefix in the name of a database object, then it could refer to the type of the database object. Do not use different prefixes in the names of database objects that have the same type.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-22 12:39MIT License