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...
141Perhaps is not snake_case - id, code, key, or nr is not followed by an underscoreFind names that perhaps do not use the snake_case naming style because the name starts with the phrase "id", "uuid", "code" , "kood", "key", or "nr" that is not followed by an underscore. Prefer snake_case over PascalCase and camelCase in names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-15 17:19MIT License
142Potentially missing default values of base table columnsFind columns of base tables without a default value that are either Boolean columns that based on the name seem to implement a state machine or temporal columns that based on the name seem to keep registration or update time. These columns often have a default value.Problem detectionINFORMATION_SCHEMA only2023-11-15 17:03MIT License
143Check as to wheteher the names of parameters are in the plural or in the singular form (Estonian version)Check as to wheteher the names of routine parameters are in the plural or in the singular form. Make sure that you are consistent in naming.GeneralINFORMATION_SCHEMA+system catalog base tables2023-11-15 16:53MIT License
144Perhaps too many square bracketsCharacter classes are surrounded by two pairs of square brackets.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-15 10:47MIT License
145Non-predefined character classes must not be between double square bracketsWrite correct regular expressions. For instance, if there is a rule that code must consist of one or more digits, then correct expression is code~'^[0-9]+$', not code~'^[[0-9]]+$'.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-13 12:32MIT License
146Views with security invokerFind views that have the security invoker option. Such option is possible starting from PostgreSQL 15. In case of using such views one cannot create a system where data is accessed through views and the users (applications) do not have direct access to the base tables.Problem detectionsystem catalog base tables only2023-11-13 12:20MIT License
147Base table column of surrogate key values does not have an integer data type (based on column names)Find base table columns that belong to a primary key, unique, or foreign key constraint and that name refers to the possibility that these are used to hold surrogate key values. Find the columns where the data type of the column is not an integer type or uuid.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-13 12:10MIT License
148Unsecure SECURITY DEFINER routinesSECURITY DEFINER routines must be secured against the malicious use of pg_temp schema. Find routines that do not explicitly set the search path or do it incorrectly (the search path is between quotation marks) and are thus potential targets of the attack. pg_temp must be the last entry in search_path. The lack of search_path is allowed only if the SQL statements in routines explicitly refer to the schemas that contain the schema objects.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-13 12:07MIT License
149Incorrect check of NULLsFind the use of =NULL and <>NULL in case of table level check constraints, domain level check constraints, WHEN clauses of triggers, WHERE clauses of rules, subqueries of derived tables, and bodies of routines. Write correct code. In order to determine as to whether a value is missing or not one has to use the IS [NOT] NULL predicate. NULL is the marker in SQL that denotes a missing value. Although it is often called "NULL value", one cannot treat it as an ordinary value, i.e., use it in comparisons as a value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-12 12:10MIT License
150Perhaps default value 'infinity' is missingFind optional base table columns that have a timestamp type and do not have a default value.Problem detectionINFORMATION_SCHEMA only2023-11-12 11:52MIT License
151Candidate keys where all columns have a static default valueFind base table primary key and unique constraints where all columns probably have a static default value. Candidate key columns (columns that belong to the primary key or to an unique constraints) shouldn't have static default values unless you are enforcing a rule that a table can have at most one row. The point of default values is that system assigns them automatically. There cannot be multiple rows with the same key value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-12 11:33MIT License
152Candidate key columns that have a static default valueFind base table columns that are covered by a primary key or a unique constraint and that probably have a static default value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-12 11:32MIT License
153Perhaps the type of a base table column/domain should be VARCHAR (based on column names)Find base table columns that have CHAR type, where character maximum length is bigger than 1 and the name of the column does not refer to the possibility that the column holds some kind of codes or flags or hash values.Problem detectionINFORMATION_SCHEMA only2023-11-12 10:48MIT License
154Perhaps an unsuitable use of CHAR(n) type in base tablesFind non-foreign key base table columns with the type CHAR(n) where n>1 that are not meant for storing codes or hash values. CHAR(n) is suitable for storing values that have a fixed length (for instance, country code according to the ISO standard). In case of variable length strings the end of the stored string is padded with spaces. Thus, for instance, do not use CHAR(n) in case of columns for storing names, comments, descriptions, e-mail addresses etc. Hash values have a fixed length that depends on the used hash function.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-12 10:46MIT License
155Column names that make joining more difficult (foreign key column name contains the table name)Find foreign keys where the name of the foreign key column and the corresponding primary key/unique column is different but the difference comes from the fact that the foreign key column name starts or ends with the table name. Simplify writing queries that have to join data from multiple base tables. If the columns that participate in the join condition have the same name, then one can use the USING syntax.Problem detectionsystem catalog base tables only2023-11-12 10:26MIT License
156Names of database objects that perhaps end with a sequence numberFind the names (identifiers) of user-defined database objects that end with one or more digit. Names should be informative. Duplicates should be avoided. Digits in names are a possible sign of duplication of database objects or unclear names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-12 10:09MIT License
157Names of database objects that perhaps end with a sequence number (aggregate view)Find the number of names (identifiers) of user-defined database objects that end with one or more digit. Names should be informative. Duplicates should be avoided. Digits in names are a possible sign of duplication of database objects or unclear names.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-11-12 10:06MIT License
158Names of database objects with four or more consecutive identical symbolsFind names of database objects with four or more consecutive identical symbolsProblem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-11 19:48MIT License
159Number of tables covered by derived tablesFind the number of base tables, the number of base tables that are referred from at least one derived table (view or materialized view), the number of base tables that are referred from at least one view, and the number of base tables that are referred from at least one materialized view. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from the subquery of at least one derived table.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-11-11 09:33MIT License
160Coverage by derived tablesFind for each base table the list of derived tables (both views and materialized views) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from the subquery of at least one derived table.GeneralINFORMATION_SCHEMA+system catalog base tables2023-11-11 09:31MIT License