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...
101Routine for reading data uses another routine to read some dataFind routines that only read data but invoke some other routine to read some more data.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-10 17:10MIT License
102Different ways how to find default timestamp valuesFind all the default values of base table, view, and foreign table columns that are expressions invoking a function that returns a timestamp. Do it only if there are different expressions, i.e., there could be possible inconsistencies.Problem detectionINFORMATION_SCHEMA only2023-12-08 16:08MIT License
103ON DELETE CASCADE is not needed (based on classifier tables)Find foreign key constraints with ON DELETE CASCADE compensating action that refer to classifier (reference data) tables.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-08 14:52MIT License
104All foreign key constraintsEnforce referential integrity in database. Find all referential integrity (foreign key) constraints.Generalsystem catalog base tables only2023-12-07 12:48MIT License
105Explicit locking is missing (2)Find user-defined routines that have a subquery in a DELETE or UPDATE statement without the FOR UPDATE clause.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-06 12:15MIT License
106Perhaps is not a snake case - date, time, or by is not preceded by an underscoreFind names that perhaps do not use the snake_case naming style because the name ends with the phrase "date", "time", "by" that is not preceded by an underscore. Prefer snake_case over PascalCase and camelCase in names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-06 12:12MIT License
107Too generic names (parameters) (there is a parameter with a more specific name in the routine)Find parameter names in case of which the same routine has another parameter with the same mode but with more specific name, i.e., the name contains the parameter name in the end or in the beginning.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-06 12:03MIT License
108Perhaps is not snake_case - Boolean-indicating prefix without underscoreFind names of types, domains, columns, and parameters that perhaps do not use the snake_case naming style because the name starts with "is", "has", or "on" that is not followed by an underscore. Prefer snake_case over PascalCase and camelCase in names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-06 11:46MIT License
109Some data modification functions return a value and some notFind as to whether there are data modification routines that return a value as well as data modification routines that do not return a value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 16:47MIT License
110Incorrect use of non-deterministic functions in CHECK constraintsDo not create a constraint in case of which data that satisfied a constraint c at the registration time suddenly does not satisfy it any more as the time goes by. Find all the check constraints that use non-deterministic functions (now, current_timestamp, localtimestamp, current_date, current_time) in a way that makes this situation possible. Fort instance, localtimestamp(0)>end_date is an example of such constraint.Problem detectionINFORMATION_SCHEMA only2023-11-29 14:59MIT License
111Prefer Polymorphism to If/Else or Switch/Case (2)Find routines with multiple raise exception commands. Perhaps it has multiple tasks and it violates the separation of concerns and single responsibilities principles.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 13:39MIT License
112Prefer Polymorphism to If/Else or Switch/CaseFind routines with IF/ELSE or SWITCH/CASE statements. If your routine has a multipart IF/CASE statement, then perhaps it has multiple tasks and it violates the separation of concerns and single responsibilities principles.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 13:31MIT License
113Updating or deleting data in a routine without restricting rowsFind user-defined routines that contain UPDATE or DELETE statement but do not contain any WHERE clause, meaning that at least one UPDATE or DELETE operation influences all the rows of a table.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 13:21MIT License
114Stating the obvious (2)Find the names of database objects where the name of the database object contains a part of the name of the object type. For instance, the query finds base tables, were the name contains fragments _base, base_, _table, or table_.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-26 17:04MIT License
115Columns for registration and update timesFind base table columns that based on the names and data types are meant for registering registration time or update time. Make sure that the columns have the same properties.GeneralINFORMATION_SCHEMA only2023-11-26 16:51MIT License
116Registration/modification time is not mandatoryFind columns that contain registration or modification time but are optional.Problem detectionINFORMATION_SCHEMA only2023-11-26 16:51MIT License
117Do 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
118Constraint-supporting UNIQUE indexes with the same leading columnFind indexes that support a uniqueness constraint and have the same leading column.Generalsystem catalog base tables only2023-11-26 16:01MIT License
119Overlapping non-function based indexes that have the same leading column with the same operator classFind non-function based indexes (both unique and non-unique) that duplicate each other because their first column is identical and the operator class that is used in case of the first column is identical. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration.Problem detectionsystem catalog base tables only2023-11-26 15:59MIT License
120Lifecycle not initiatedFind non-primary key and non-unique base table foreign key columns that name refers to the possibility that these are used to register references to a state classifier. The column must belong to a foreign key and does not have a default value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-26 15:40MIT License