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...
721SET NULL compensatory action is unsuitableFind foreign key constraints that use a SET NULL compensating action but a foreign key column is mandatory, i.e., does not permit NULLs. Compensatory actions cannot make changes that violate integrity constraints in a database. SET NULL cannot put NULL to a mandatory column (delete a foreign key value).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
722Sorting 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
723STATEMENT 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
724Table privileges have been granted to PUBLICYou should follow the principle of least privilege and thus not have in your database tables that usage privileges are granted to the pseudo-role PUBLIC, i.e., to all the database users now and in the future.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
725Table, routine, and usage privileges that have been granted to a superuserFind table, routine, and usage privileges that have been granted to a superuser. Superuser can do anything in the database and thus does not need the privileges. The result is a sign that perhaps the executed GRANT statements were incorrect (wrong username) or the grantee later got superuser status (that it shouldn't have).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
726TG_ARGV is missingWrite correct code. If you pass arguments to a trigger function, then the function should use the arguments. TG_ARGV[]: "Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indexes (less than 0 or greater than or equal to tg_nargs) result in a null value." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
727Three-valued logic (Boolean columns)Find base table columns that have Boolean type and do not have NOT NULL constraint. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the Boolean columns mandatory.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
728Trigger is used to enforce referential integrityFind tables where user-defined (non-system) triggers are used to implement referential integrity. In addition to table name show the triggers and the number of triggers.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
729Triggers with the same name within the same schemaFind names of triggers that are used within the same schema more than once. Give different triggers different names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
730Unique index definition instead of a key declarationFind cases where a unique constraint (that is not case-insensitive or partial, i.e., applies only to certain rows) has been enforced by using a CREATE UNIQUE INDEX statement instead declaring a PRIMARY KEY, UNIQUE, or EXCLUDE constraint. You should try to work on as high level of abstraction as possible. According to the ANSI-SPARC Architecture indexes are a part of internal database schema whereas constraints are a part of conceptual schema, i.e., at the higher level of abstraction.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
731Unnecessary privileges to use trigger functionsA user that corresponds to an application does not have to have privileges to use trigger functions. If it has these, then it violates the principle of least privilege.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
732Unnecessary usage of the numeric type in case of base table columnsFind base table columns that have type NUMERIC and the scale is 0, i.e., one can record in the column only integer values. Arithmetic operations are slower in case of the numeric type compared to an integer type. Thus, in order to record integer values, one should use columns with the type SMALLINT, INTEGER, or BIGINT instead of NUMERIC(p,0).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
733Unused composite types (for table columns, typed tables, input and output parameters)Find user-defined composite types that are not used in case of any table, column, and routine (input or otput) parameter (as their type). Do not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
734Unused domains (for base table columns and parameters)Find domains that are not used in case of any base table column and routine (input or otput) parameter (as their type). Do not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
735Unused enumerated types (for base table columns, domains, and parameters)Find enumerated types that are not used in case of any base table column, domain, and routine (input or otput) parameter (as their type). Do not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
736Unused foreign data wrappersFind foreign data wrappers that do not have any associated foreign servers.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
737Unused foreign serversFind foreign servers that do not have any associated foreign tables.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
738Unused schemasDo not keep in your database elements that are not needed by anybody. These should be put in use or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
739User-defined routine execution privilege has been granted to PUBLICYou should follow the principle of least privilege and thus not have in your database user-defined routines that execution privilege is granted to PUBLIC, i.e., to all the database users now and in the future. By default, PostgreSQL gives routine execution privileges to PUBLIC.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
740User-defined routines that have the same name as some system-defined routine.Avoid creating user-defined routines that have the same name as some system-defined routine because it may cause confusion.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License