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...
541Parameter name is the same as the routine nameFind parameters that have the same name as the routine. The names may have different uppercase/lowercase characters. Make sure that the naming style is consistent.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-06 18:03MIT License
542Partial or case insensitive unique indexesFind partial or case insensitive unique indexes. These implement uniqueness constraints that are impossible to enforce with the help of SQL's regular UNIQUE constraint.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
543All declaratively partitioned tablesFind partitioned tables that have been implemented by using the declarative approach. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 15:13MIT License
544Patterns of the Boolean expressions of simple CHECK constraintsFind patterns of the Boolean expressions of simple CHECK constraints (involve only one column). Do not solve the same task in different places differently. The same rule could be implemented with CHECK constraints that have different Boolean expressions. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)GeneralINFORMATION_SCHEMA+system catalog base tables2022-11-13 16:06MIT License
545Patterns of the names of PRIMARY KEY, UNIQUE, CHECK, EXCLUDE, and FOREIGN KEY constraints as well as user-defined non-unique indexes that are associated with exactly one columnFind patterns of the names of constraints and indexes. Make sure that the naming is consistent.GeneralINFORMATION_SCHEMA+system catalog base tables2023-01-14 20:52MIT License
546Patterns of the names of PRIMARY KEY, UNIQUE, CHECK, EXCLUDE, and FOREIGN KEY constraints as well as user-defined non-unique indexes that are associated with two or three columnsFind patterns of the names of constraints and indexes. Make sure that the naming is consistent.GeneralINFORMATION_SCHEMA+system catalog base tables2023-01-14 20:52MIT License
547PL/pgSQL functions with consecutive RETURN clausesFind PL/pgSQL functions with consecutive RETURN clauses. Only the first RETURN will be used, others are unnecessary.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-16 11:38MIT License
548Routines that use old syntax for limiting rowsFind PL/pgSQL routines and SQL routines that do not have SQL-standard body that use unstandardized LIMIT clause instead of standardized FETCH FIRST n ROWS clause. The query excludes routines that are a part of an extension.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-10-29 11:34MIT License
549Perhaps unnecessary DECLARE section in a PL/pgSQL routine (2)Find PL/pgSQL routines that perhaps unnecessarily contain DECLARE section. More specifically, find routines with the DECLARE section where the keyword DECLARE is followed by BEGIN, i.e., the DECLARE section is empty.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-23 13:39MIT License
550Perhaps unnecessary DECLARE section in a PL/pgSQL routineFind PL/pgSQL routines that perhaps unnecessarily contain DECLARE section. More specifically, find routines with the DECLARE section where the only task seems to be raising an exception. The query excludes the cases where the error message is constructed dynamically, i.e., in this case using a variable maybe justifiable.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 10:19MIT License
551Incorrect comparison operatorFind PL/pgSQL routines that use comparison operators =< or =>.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-11 14:50MIT License
552PL/pgSQL routine with plain SELECTFind PL/pgSQL that contain a SELECT statement that is not a SELECT … INTO statement. This is not permitted in PL/pgSQL routines.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 17:07MIT License
553Simple 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
554Definition of a non-minimal superkey instead of a candidate key (based on key constraints)Find primary/key unique constraints (sets of columns) that are proper subsets of other primary key/unique constraints of the same table. Candidate key is a minimal superkey, meaning that it is not possible to remove columns from the candidate key without losing its uniqueness property. One should define primary key's and unique constraints based on candidate keys, i.e., the keys should not have redundancy in terms of columns.Problem detectionsystem catalog base tables only2021-10-16 10:29MIT License
555Constraints that are redefined in a subtable.Find primary key, unique, foreign key, and exclude constraints that have been defined in a supertable (parent table) and have been redefined in its subtable.Generalsystem catalog base tables only2020-12-02 17:28MIT License
556Constraints that are not redefined in a subtable and there is no CHECK constraint that compensates thisFind primary key, unique, foreign key, and exclude constraints that have been defined in a supertable (parent table) but not in its subtable. Additional condition is that in case of the subtable there is no CHECK that permits only one specific value in the constraint column. The presence of such check would make the design acceptable. Unfortunately, PostgreSQL table inheritance is implemented in a manner that some constraints (CHECK, NOT NULL) are inherited from the supertable but others are not. "All check constraints and not-null constraints on a parent table are automatically inherited by its children, unless explicitly specified otherwise with NO INHERIT clauses. Other types of constraints (unique, primary key, and foreign key constraints) are not inherited." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
557Constraints that are not redefined in a subtable but there is a CHECK constraint that compensates thisFind primary key, unique, foreign key, and exclude constraints that have been defined in a supertable (parent table) but not in its subtable. Exclude constraints where in case of the subtable there is a CHECK that permits only one specific value in the constraint column. The presence of such check would make the design acceptable. Unfortunately, PostgreSQL table inheritance is implemented in a manner that some constraints (CHECK, NOT NULL) are inherited from the supertable but others are not. "All check constraints and not-null constraints on a parent table are automatically inherited by its children, unless explicitly specified otherwise with NO INHERIT clauses. Other types of constraints (unique, primary key, and foreign key constraints) are not inherited." (PostgreSQL documentation)GeneralINFORMATION_SCHEMA+system catalog base tables2020-12-25 16:20MIT License
558Constraints that are not redefined in a subtableFind primary key, unique, foreign key, and exclude constraints that have been defined in a supertable (parent table) but not in its subtable. Unfortunately, PostgreSQL table inheritance is implemented in a manner that some constraints (CHECK, NOT NULL) are inherited from the supertable but others are not. "All check constraints and not-null constraints on a parent table are automatically inherited by its children, unless explicitly specified otherwise with NO INHERIT clauses. Other types of constraints (unique, primary key, and foreign key constraints) are not inherited." (PostgreSQL documentation)Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
559Candidate keys and foreign keys of tables that participate in an inheritance hierarchiesFind primary key, unique, foreign key, and exclude constraints that have been defined in tables that participate in an inheritance hierarchy. Do not forget to redefine the constraints that are defined on supertables also on their subtables.Generalsystem catalog base tables only2020-11-06 14:51MIT License
560Privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign serversFind privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign servers that are not for the owner and not for the systemic user postgres. Make sure that there is the right amount of privileges for each and every relevant user.Generalsystem catalog base tables only2021-03-07 20:57MIT License