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...
361Do not leave out the referential constraints (based on column names)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, do not have an associated sequence generator, but have a name that reffers to the possibility that these are used to record some kind of codes or id's.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-26 16:35MIT License
362Do 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
363Do not leave out the referential constraints (islands)Try to find missing foreign key constraints. Find base tables that do not participate in any referential constraint (as the referenced table or as the referencing table). These tables are like "islands" in the database schema.Problem detectionsystem catalog base tables only2021-03-10 12:20MIT License
364Do not leave out the referential constraints (pairs of tables)Try to find missing foreign key constraints. Find pairs of base table columns that have the similar name, perhaps the same type, and that are not associated through a foreign key relationship.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
365Do not refer to the table schema in the references to columnsFind routines where in SELECT or UPDATE statements references to columns are prefixed with references to the table schema. Referring to schema in this context bloats the code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 17:32MIT License
366Do not register durationFind columns of base and foreign tables that based on the column name and type are used to register duration (including the age).Problem detectionINFORMATION_SCHEMA only2021-03-12 14:48MIT License
367Do not specify a list of values in a table column definitionFind cases where the list of valid data values in the column is specified in the column definition (in addition to specifying the type of the column) by using, for instance, check constraints or enumerated types. The check constraint is either associated directly with a table or is associated with a domain.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-06-09 14:30MIT License
368Do not use a generic attribute tableFind base tables that implement a highly generic database design (EAV design - Entiry-Attribute-Value design), according to which attribute values are recorded in a generic table that contains attribute-value pairs.Problem detectionINFORMATION_SCHEMA only2021-03-07 17:40MIT License
369Do not use approach that one size fits all (primary key columns)Find base base tables have the simple primary key that contains the column with the (case insensitive) name id and an integer type. In addition, the primary key values are generated automatically by the system by using a sequence generator.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-18 20:58MIT License
370Do not use approach that one size fits all (unique index columns)Find base base tables have a simple unique index (not associated with a constraint) that contains the column with the (case insensitive) name id and an integer type. In addition, the key values are generated automatically by the system by using a sequence generator.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-07 15:12MIT License
371Do not use dual-purpose foreign keysFind cases where the same column of a base table T is used to record references to multiple base tables. In addition, one has to add additional column to T for holding metadata about the parent table, referenced by the current row.Problem detectionINFORMATION_SCHEMA only2021-03-07 10:56MIT License
372Do not use FLOAT Data TypeFind base table columns that have FLOAT, REAL, or DOUBLE PRECISION type. "The data types real and double precision are inexact, variable-precision numeric types. On all currently supported platforms, these types are implementations of IEEE Standard 754 for Binary Floating-Point Arithmetic (single and double precision, respectively), to the extent that the underlying processor, operating system, and compiler support it." (PostgreSQL documentation) Do not use the approximate numeric types FLOAT, REAL, and DOUBLE PRECISION in order to present fractional numeric data. Due to the use of the IEEE 754 standard the results of calculations with the values, which have one of these types, can be inexact because out of necessity some numbers must be rounded to a value, which is very close. "Comparing two floating-point values for equality might not always work as expected." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA only2021-03-12 15:41MIT License
373Do not use the money data typeFind base table columns with the Money data type. Each value of the money type has associated currency sign that depends on server settings. It could be $. Moreover, using the values for arithmetic operations requires casts that makes the code more complicated.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
374Double checking of the maximum character lengthDo not duplicate code. In this case a CHECK constraint duplicates the restriction that is already enforced with the help of the declaration of the maximum field size (for instance, VARCHAR(100)).Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-18 13:27MIT License
375Double negatives in Boolean expressionsWrite code that is simple to understand and not confusing. A double negative is a grammatical construction occurring when two forms of negation are used in the same expression (https://en.wikipedia.org/wiki/Double_negative). Double negatives in Boolean expressions make it more difficult to understand and maintain the code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
376Double negatives in regular expressionsFing regular expression patterns that use [^\S] instead of \s or [^\D] instead of \d or [^\W] instead of \w.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-09 12:01MIT License
377Do you really need fractional seconds?Find default values that return current timestamp with the maximum number of fractional seconds (6).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
378Duplicate CHECK constraints that are connected directly to a tableThe same table should not have multiple CHECK constraints with exactly the same Boolean expression. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
379Duplicate CHECK constraints that are connected to a domainThe same domain should not have multiple CHECK constraints with exactly the same Boolean expression. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
380Duplicate check of empty stringsFind columns that have a check that prevents the empty string in the column but there is already another check on the column that enforces the constraint. If there is a constraint description!~'^[[:space:]]*$', then it covers the constraint description!='' and the latter becomes redundant.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-19 15:08MIT License