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...
941Pairs of base tables that have at least two columns with the same names and data typesWhat are the pairs of base tables that have at least two columns with the same names and data types. The tables might violate the principle of orthogonal design and hence might facilitate uncontrolled data redundancy over different tables.Problem detectionINFORMATION_SCHEMA only2022-11-09 13:13MIT License
942Percentage of optional columns in each base tableWhat is the percentage of optional columns (that permit NULLs) in case of each base table? It is better to prohibit the use of NULLs in as many columns as possible. Otherwise the results of queries may be misleading.Sofware measureINFORMATION_SCHEMA only2020-11-08 20:55MIT License
943PL/pgSQL routines that use a cursorWorking with sets of rows rather than processing each row separately is more effective.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:54MIT License
944Using routine name in front of a parameter name in a routine body to refer to the parameter of the routineWrite code that is easy to understand and not unnecessarily long. A routine cannot have two or more parameters with the same name. In this case using longer identifier in the form routine_name.parameter name is unnecessary.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 13:40MIT License
945Double negatives in Boolean expressionsWrite code that is simple to understand and not confusing. A double negative is a grammatical construction occurring when two forms of negation are used in the same expression (https://en.wikipedia.org/wiki/Double_negative). Double negatives in Boolean expressions make it more difficult to understand and maintain the code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
946TG_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
947STATEMENT 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
948CHECK constraint cardinality is zeroWrite correct constraints. Usually the constraint expression should refer to at least one column. A domain constraint expression should refer to the stub VALUE. For instance, the constraint CHECK(1=0) that is associated with a table T would prevent adding any rows to T. The value of the Boolean expression of this constraint is always FALSE.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-04-22 17:06MIT License
949Non-predefined character classes must not be between double square bracketsWrite correct regular expressions. For instance, if there is a rule that code must consist of one or more digits, then correct expression is code~'^[0-9]+$', not code~'^[[0-9]]+$'.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-13 12:32MIT License
950Unbalanced bracketsWrite expressions correctly. Find code fragments that have unbalanced brackets, i.e., the number of opening brackets is not the same as the number of closing brackets.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-24 16:02MIT License
951search_path should not be between quotation marksWrite security definer functions securely. Give to the DBMS correctly information about the sequence of schemas that constitute the search path. You shouldn't write search path value between quotation marks or apostrophes. Thus, instead of writing SET search_path = "public, pg_temp"; or SET search_path = 'public, pg_temp'; you should write SET search_path = public, pg_temp;Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-03 21:10MIT License
952Procedures cannot have START TRANSACTION and SAVEPOINTYou cannot use a START TRANSACTION or a SAVEPOINT statement in a procedure. Procedures appeared in PostgreSQL 11.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:50MIT License
953SECURITY DEFINER procedures cannot end transactionsYou cannot use COMMIT and ROLLBACK in a SECURITY DEFINER procedure. Procedures appeared in PostgreSQL 11.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:12MIT License
954Explicit locking is probably not neededYou do not need explicit locking (LOCK TABLE or SELECT … FOR UPDATE) in case of routines that only search some data but do not modify any data and do not raise any exception.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:08MIT License
955Insufficient view privilegesYou must give privileges to use views to the users/roles that correspond to applicationsProblem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
956Insufficient routine privilegesYou must give rights to use routines to the users/roles that correspond to applications.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
957Table 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
958User-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
959LEAKPROOF 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
960The total size of all indexes (system catalog excluded)Sofware measuresystem catalog base tables only2023-05-14 11:04MIT License