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...
581Routines without an actionFind routines that body does not contain any action.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 12:14MIT License
582Sorting 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
583Sorting 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
584User-defined routines that use xmin hidden columnFind routines that contain a UPDATE or a DELETE statement that search condition refers to the xmin column. If one uses optimistic approach for dealing with the concurrent modifications of data, then xmin values should be presented by views and used in routines that modify or delete rows.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:30MIT License
585Polymorphic routinesFind routines that have a parameter (input or output) that can have values from different types. This parameter has one of the PostgreSQL polymorphic types. The set of polymorphic types in PostgreSQL is a proper subset of its pseudo-types. The use of such a parameter allows a single routine definition to operate on many different data types, with the specific data type(s) being determined by the data types actually passed to it in a particular call.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:12MIT License
586User-defined routines with dynamic SQL that are potential targets of the SQL injection attackFind routines that have at least one input parameter, use dynamic SQL but do not escape the input arguments at all.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:58MIT License
587Routine for reading data uses another routine to read some dataFind routines that only read data but invoke some other routine to read some more data.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-10 17:10MIT License
588Meaningless terms in routinesFind routines that subquery contains terms "foo", "bar", "foobar", or "baz".Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-06 14:09MIT License
589User-defined routines with dynamic SQLFind routines that use dynamic SQL. Make sure that dynamic SQL is indeed needed, i.e., the task cannot be solved with static SQL. Make sure that the routine is protected against attacks that use SQL injection method.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:09MIT License
590FOR 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
591Perhaps inconsistent use of temporal functionsFind routines that use temporal functions CURRENT_TIMESTAMP, LOCALTIMESTAMP, or now() that is inconsistent with the default values of the columns that are used by the routine, e.g., function uses a column with the default value LOCALTIMESTAMP but the routine uses function CURRENT_TIMESTAMP or now().Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-10 17:11MIT License
592Do not refer to the table schema in the references to columnsFind routines where in SELECT or UPDATE statements references to columns are prefixed with references to the table schema. Referring to schema in this context bloats the code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 17:32MIT License
593Routine body with ordering the query result based on positional referencesFind routines where the query result is sorted based on the column number in the SELECT clause. Such query is sensitive towards changing the order of columns in the SELECT clause, i.e., if one changes the order of columns in the SELECT clause, then one must change the numbers in the ORDER BY clause as well, otherwise the query will produce undesired order of rows.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-31 15:23MIT License
594Routines that can be invoked with a variable number of argumentsFind routines with a VARIADIC parameter. These are routines that take as input an undefined number of arguments where the argument that is an undefined number are all of the same type and are the last input arguments.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:37MIT License
595Prefer Polymorphism to If/Else or Switch/CaseFind routines with IF/ELSE or SWITCH/CASE statements. If your routine has a multipart IF/CASE statement, then perhaps it has multiple tasks and it violates the separation of concerns and single responsibilities principles.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 13:31MIT License
596Prefer Polymorphism to If/Else or Switch/Case (2)Find routines with multiple raise exception commands. Perhaps it has multiple tasks and it violates the separation of concerns and single responsibilities principles.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-29 13:39MIT License
597Perhaps updating of modification time is missingFind routines with SQL-standard body that seem to update data in a table that has a column for modification time but the routine does not seem to update the modification time while updating the row.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-24 12:59MIT License
598User-defined routines with the same parameters (same name and type) regardless of the order of parametersFind routines with the same parameters (same name and type) regardless of the order of parameters. Make sure that there is no accidental duplication. The query helps users to group together routines that probably have related tasks.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
599Perhaps a reference to the variable OLD is missingFind row level before delete triggers that only task is not to raise an exception and where the variable OLD is not used in the trigger routine outside the RETURN clause.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-21 19:29MIT License
600Perhaps a reference to the variable NEW is missingFind row level before insert and before update triggers that only task is not to raise an exception and where the variable NEW is not used in the trigger routine outside the RETURN clause.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-21 20:34MIT License