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...
741Should the time zone be recorded in case of timestamp or not?Find all the base table columns that have the type timestamp without time zone or timestamp with time zone. Return the data only if there is at least one column with the type timestamp without time zone and one column with the type timestamp with time zone.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
742Simple check constraints with multiple tasksFind simple check constraints, i.e., check constraints that cover one column that seem to have multiple tasks. The corresponding code smell in case of cleaning code is "G30: Functions Should Do One Thing". (Robert C. Martin, Clean Code)Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-01 11:42MIT License
743Simple natural primary keysFind primary keys that consist of one column and that values are not generated by the system.GeneralINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:47MIT License
744Simple primary keys that column name does not contain the table nameFind simple primary keys that column name does not contain the table name. The naming should be clear and consistent.Problem detectionsystem catalog base tables only2023-03-19 10:35MIT License
745Small tablesFind tables that have one column or zero columns.GeneralINFORMATION_SCHEMA+system catalog base tables2021-03-07 10:52MIT License
746Some candidate key values cannot be used as foreign key valuesFind foreign key constraints in case of which some candidate key values cannot be used as foreign key values. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:13MIT License
747Some CHECKS are associated with a domain and some with the base table columns that have the domainFind cases where some CHECKS are associated with a domain and some with the base table columns that have the domain. Avoid duplication of code. Write as little code as possible. If possible, move things "before the brackets" so to say. In this case it means declaring CHECKS at the level of the domain and not at the level of base table columns.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
748Some 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
749Sometimes regexp_like, sometimes ~Find as to whether you sometimes use regexp_like function and sometimes ~ operator. These implement the same functionality. regexp_like function that was added to PostgreSQL 15 and provides the same functionality as ~ and ~* operators. Try to be consistent.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-12-13 13:23MIT License
750Sorting rows based on random values in derived tablesFind derived tables (views and materialized views) that sort rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
751Sorting rows based on random values in derived tables without limiting rowsFind derived tables (views and materialized views) that sort rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
752Sorting rows based on random values in routinesFind routines that contain a statement that sorts rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:56MIT License
753Sorting rows based on random values in routines without limiting rowsFind routines that contain a statement that sorts rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:57MIT License
754SQL function does not return a valueFind SQL functions that do not return a value (return VOID) but the SQL statement in the function has RETURNING clause.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-02-27 17:28MIT License
755SQL functions that use optimistic approach for locking but do not return a valueFind SQL functions that use a hidden column of PostgreSQL tables - xmin - to implement optimistic locking but do not return any information to the invoker of the functions, i.e., whether the update/delete operation succeeded or not. The functions should let their invokers know as to whether the function succeeded in updating or deleting a row.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:06MIT License
756STATEMENT level triggers and ROW level AFTER triggers without RETURN NULLWrite correct code "The return value of a row-level trigger fired AFTER or a statement-level trigger fired BEFORE or AFTER is always ignored; it might as well be null." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
757STATEMENT level triggers that refer to the values of row variables NEW or OLDFind STATEMENT level triggers that refer to the values of row variables NEW or OLD. NEW and OLD are special variables that can only be used in row-level trigger procedures.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-20 14:23MIT License
758Stating the obviousFind database objects that name contains words "data" or "info". These are noise words because databases are meant for storing and manipulating data/information.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 10:37MIT License
759Stating 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
760Stating the obvious (column names)Find the names of columns where the name of the column contains a part of the name of the data type of the column. For instance, the query finds columns, were the name contains fragments integer_ or _integer.Problem detectionINFORMATION_SCHEMA only2023-11-04 15:19MIT License