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...
461All short cycles (tables)Find pairs of tables that have both a foreign key that references to the other table. Such cycles can involve more than two tables but the query detects only cycles with two tables.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-27 20:54MIT License
462Short cycles (tables)Find pairs of tables that have both a mandatory (NOT NULL) and not defrerrable foreign key that references to the other table. Such cycles can involve more than two tables but the query detects only cycles with two tables.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-27 20:52MIT License
463Perhaps unnecessary privileges to use the databaseFind as to whether a database user (except postgres), who is not a superuser, has Create (C) or Temporary (T) privileges to use the database.Problem detectionsystem catalog base tables only2021-11-23 20:42MIT License
464All database privilegesFind the privileges to use the database. c - CONNECT; C - CREATE; T - TEMPORARY.Generalsystem catalog base tables only2021-11-23 20:28MIT License
465PUBLIC has the USAGE privilege of a schemaFind schemas where PUBLIC has the usage privilege.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-23 17:52MIT License
466The number of default valuesFind the total number of columns with a default value as well as the number of columns with different kinds of default values (the number of columns where the default is used to implement surrogate key, the number of columns where the default is not used to implement surrogate key, the number of columns with a static default value, the number of columns with a dynamic default value).Sofware measureINFORMATION_SCHEMA only2021-11-22 13:26MIT License
467Database connect privilege is missingFind non-superusers who have a privilege to use a table or a routine but do not have the privilege to connect to the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-21 13:51MIT License
468Missing USAGE privileges on schemaIf a user has a privilege to use a schema object, then the user must also have the usage privilege on the schema that contains the object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-21 12:06MIT License
469Incorrect prefix of a constraint name or an index nameIf the name of an object has the prefix that refers to the type of the object (for instance, primary key constraint or foreign key constraint), then you should use references to the correct object type. Find prefixes of constraint names and index names that incorrectly refer to the type of the object. For instance, incorrect would be to use chk_ as the prefix of an index name or pk_ as the prefix of a check constraint name.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-18 21:08MIT License
470Naming of tablesFind the names of different types (base table, foreign table, view, materialized view) of tables. Naming of tables must be consistent. For instance, do not mix names in plural and singular form within the same table type.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-17 20:13MIT License
471Naming of declarative base table constraintsFind the names of declarative base table constraints. Naming of constraints must be consistent. For instance, do not mix system-defined and user-defined names.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-17 20:11MIT License
472All column dynamic DEFAULT values values that do not invoke a sequenceFind all columns that have a dynamic default value, i.e., the value is returned by a function but the function is not for invoking a sequence.GeneralINFORMATION_SCHEMA only2021-11-15 15:57MIT License
473All column static DEFAULT valuesFind all columns that have a static default value, i.e., the value is not returned by a function.GeneralINFORMATION_SCHEMA only2021-11-15 15:57MIT License
474Tables with the same name in different schemasFind tables with the same name in different schemas. Make sure that this is not a duplication.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-10 15:40MIT License
475More than one index on a columnFind base table columns that belong to more than one index (including automatically created indexes that support constraints).Generalsystem catalog base tables only2021-11-10 14:44MIT License
476Too wide composite indexesFind composite indexes that do not support any constraint but are on more than three columns.Problem detectionsystem catalog base tables only2021-11-06 02:40MIT License
477Coverage by routines that have the SQL-standard bodyFind for each base table the list of routines (functions and procedures) that refer to the base table. If the database is used through the public database interface (virtual data layer), then, ideally, each table is referred from at least one routine.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-05 17:00MIT License
478User-defined routines that use keyword DECLARE but do not declare anythingFind user-defined routines that use keyword DECLARE but do not declare anything.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 14:47MIT License
479LEAKPROOF routines that are perhaps not leakproofYou should not give wrong information to the database management system.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 14:12MIT License
480FOR UPDATE is not needed if there is no FROM clause in the SELECT statementFind routines that use SELECT … FOR UPDATE without selecting rows from a specific table. For instance: SELECT 'text' AS v FOR UPDATE;Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 14:10MIT License