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...
221Check as to wheteher the names of columns are in the plural or in the singular form (Estonian version)Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming.GeneralINFORMATION_SCHEMA+system catalog base tables2023-10-26 17:01MIT License
222Inconsistent use of functions and proceduresFind as to whether the database has both procedures as well as functions that do not return a value (i.e., return VOID). Such routines are generally used to modify data in the database. The support of procedures was added to PostgreSQL 11.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-26 15:05MIT License
223All unique keys have at least one optional columnFind base tables where all unique keys (sets of columns covered by a unique constraint, or a unique index) have at least one optional column. In this case there can be rows in the table where the values that should identify the row are missing. Because NULL is not a value and is not duplicate of another NULL the, follwing is possible: CREATE TABLE Uniq(a INTEGER NOT NULL,
b INTEGER,
CONSTRAINT ak_uniq UNIQUE (a, b));

INSERT INTO Uniq(a, b) VALUES (1, NULL);
INSERT INTO Uniq(a, b) VALUES (1, NULL);
Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-21 11:54MIT License
224Base tables that have a surrogate key and all its unique constraints have an optional columnA surrogate key is a primary key that consist of one column. The values of this column do not have any meaning for the user and the system usually generates the values (integers) automatically. In case of defining a surrogate key in a table it is a common mistake to forget declaring existing natural keys in the table. If a key covers an optional column then it does not prevent duplicate rows where some values are missing and other values are equal. Because NULL is not a value and is not duplicate of another NULL the, follwing is possible: CREATE TABLE Uniq(a INTEGER NOT NULL,
b INTEGER,
CONSTRAINT ak_uniq UNIQUE (a, b));

INSERT INTO Uniq(a, b) VALUES (1, NULL);
INSERT INTO Uniq(a, b) VALUES (1, NULL);
Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-21 11:54MIT License
225Regular expression with possibly a LIKE patternFind expressions that use a regular expression with a like predicate pattern.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-21 11:11MIT License
226LIKE with a regular expression patternFind expressions that use LIKE (including ILIKE) predicate with a regular expression patterns. In a LIKE pattern one can use only _ and % metasymbols to construct a pattern.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-21 10:38MIT License
227NOT NULL domainsFind domains with NOT NULL constraints and base table columns that have been defined based on the domain. PostgreSQL CREATE DOMAIN statement documentation points out that it is possible to add NULL's to columns that have a NOT NULL domain and thus suggests to associate NOT NULL constraints with a column instead of the domain. However, this is a non-standard behavior and defeats the idea of domain as a reusable asset. The scenarios where NULLs can appear in columns with a NOT NULL domain are quite exotic and probably cannot appear in production environments.GeneralINFORMATION_SCHEMA+system catalog base tables2023-10-20 19:10MIT License
228NOT NULL constraint is directly associated with a column instead of the domain of the columnFind mandatory (NOT NULL) base table columns that have been defined based on the same domain but the NOT NULL constraint is associated directly with the column not to the domain. PostgreSQL CREATE DOMAIN statement documentation points out that it is possible to add NULL's to columns that have a NOT NULL domain and thus suggests to associate NOT NULL constraints with a column instead of the domain. However, this is a non-standard behavior and defeats the idea of domain as a reusable asset. The scenarios where NULLs can appear in columns with a NOT NULL domain are quite exotic and probably cannot appear in production environments.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-20 15:34MIT License
229Comments of columnsFind all comments of columns of tables.Generalsystem catalog base tables only2023-10-18 14:09MIT License
230Sequences that are not owned by a table columnFind sequence generators that are not owned by a table column, i.e., if one drops the table or the column, then the sequence generator stays in place.Problem detectionsystem catalog base tables only2023-10-06 14:40MIT License
231ON UPDATE CASCADE is probably missing (based on data types)Find foreign key constraints where the foreign key column does not have an integer type or uuid type and the foreign key constraint does not have ON UPDATE CASCADE compensating action. In this case the foreign key probably refferes to a natural key (i.e., a key that values have meaning outside the computer system) and ON UPDATE CASCADE would be suitable because the key values could be changed over time.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-06 14:19MIT License
232Base table columns permitting negative prices/quantityFind non-foreign key base table columns that name refers to the possibility that these are used to register prices/quantities. Find the columns that do not have any simple CHECK constraints, i.e., a constraint that covers only this column. In this case registration of negative price/quantity is most probably not prohibited.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-06 14:14MIT License
233Perhaps check constraint names contain incorrect or unnecessary wordsFind names of check constraints (either associated with a base table or a domain) that names contain words that are not needed in the name. For instance, constraints cannot ensure the correctness of data and thus the word correct should not be used in the names. Words like "valid" or phrases like "follows_rules" are just noise because all the constraint ensure that the registered data values are valid and follow certain rules.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-06 14:10MIT License
234Vacuum and analyze status of base tablesFind for each base table the last time when the table has been vacuumed or analyzed (either manually or automatically).Generalsystem catalog base tables only2023-10-06 13:48MIT License
235The total size of all indexes (system catalog excluded)Sofware measuresystem catalog base tables only2023-05-14 11:04MIT License
236The total size of all tables (system catalog excluded)Sofware measuresystem catalog base tables only2023-05-14 11:04MIT License
237Check as to wheteher the names of columns are in the plural or in the singular form (English version) (aggregate view)Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of columns that name is in plural or in singular by table type.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-20 13:19MIT License
238Check as to wheteher the names of columns are in the plural or in the singular form (English version)Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming.GeneralINFORMATION_SCHEMA+system catalog base tables2023-03-20 13:18MIT License
239Too generic names (columns) (there is a column with a more specific name in the table)Find column names in case of which the same table has another column (with more specific name) that name contains the column name in the end or in the beginning. For instance, a base table has columns parent and root_parent and the former col-umn name is too generic, i.e., it should be more specific.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-20 01:01MIT License
240Too short names of database objects"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) The names should be meaningful and searchable. Find the names (identifiers) of user-defined database objects that are shorter than three characters.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-19 11:07MIT License