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...
741Triggers that are used to calculate tsvector values react to a wrong set of eventsFind triggers on base tables that are used to calculate tsvector values that react to a wrong set of events, i.e., react to the DELETE event or do not react to the INSERT and UPDATE events.Problem detectionsystem catalog base tables only2023-11-07 10:14MIT License
742Triggers with arguments from the CREATE TRIGGER statementFind triggers that get an argument from the CREATE TRIGGER statement.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-22 12:35MIT License
743Update prevention may prevent legal updatesFind triggers that try prevent updating data in a certain column but prevent also certain legal updates - updates that write to a field a value that was in the field before the update.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-07-07 13:12MIT License
744Too generic names (unique indexes)Find unique indexes that have too generic names like "key" or the name contain too generic words like "data" (all constraints restrict data in the table), or the name is an abbreviation of a constraint type name.Problem detectionsystem catalog base tables only2023-01-08 10:38MIT License
745Too generic names (unique index columns)Find unique index (not associated with a constraint) columns with the names like id, identifikaator, code, kood, number, etc. The names could have underscores as the prefix or suffix. These are too generic names.Problem detectionsystem catalog base tables only2023-01-07 20:34MIT License
746Unlogged tablesFind unlogged tables. These may improve the performance of INSERT operations, but with the price of possibly loosing data - an unlogged table is automatically truncated after a crash or unclean shutdown.Generalsystem catalog base tables only2020-11-06 14:51MIT License
747Unnamed parametersFind unnamed parameters in PL/PGSQL routines that do not declare aliases for parameters and in SQL routines. Avoid unnamed parameters because dependency on position in case of referencing the parameters makes evolving the code more difficult. In case of unnamed parameters - if one changes the order of parameters in the routine signature, then one has to change the body of the routine in order to use correct references. The bigger is the number of parameters in a routine the more the unnamed parameters make it more difficult to understand the routine.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-15 18:16MIT License
748Updatable views that do not have WITH CHECK OPTION constraintFind updatable views that do not have WITH CHECK OPTION constraint. WITH CHECK OPTION constraint prevents updates through the view that violate the predicate of the view. Such updates must be prevented.Problem detectionINFORMATION_SCHEMA only2023-10-29 10:33MIT License
749Views with the WITH LOCAL CHECK OPTION constraintFind updatable views that have WITH LOCAL CHECK OPTION constraint. The predicate of a view is the conjunction of the predicates of its (directly and indirectly) underlying tables (both base tables and derived tables) as well as the predicate of the view itself. In case of using WITH LOCAL CHECK OPTION constraint "New rows are only checked against the conditions defined directly in the view itself. Any conditions defined on underlying base views are not checked (unless they also specify the CHECK OPTION)." (PostgreSQL manual) Thus, use instead WITH CASCADED CHECK option to instruct the system to check new rows against the entire predicate of the view.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
750Updatable views with WHERE clause that do not have WITH CHECK OPTION constraintFind updatable views that restrict rows, i.e., have WHERE clause, but do not have WITH CHECK OPTION constraint. WITH CHECK OPTION constraint prevents updates through the view that violate the predicate of the view. Such updates must be prevented.Problem detectionINFORMATION_SCHEMA only2024-01-14 17:11MIT License
751Grantable usage privilegesFind usage privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-07 13:43MIT License
752Unused 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
753User-defined non-trigger routines without parametersFind user-defined non-trigger routines with no parameters.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-03 20:05MIT License
754A setter does not update a tableFind user-defined non-trigger SQL and PL/pgSQL routines that name starts with "set" (but not with "setting") but do not contain a UPDATE statement.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-27 18:35MIT License
755The name of the routine does not match with the action of the routineFind user-defined non-trigger SQL and PL/pgSQL routines where the beginning of the name of the routine indicates a certain action inside the routine (INSERT, UPDATE, or DELETE) but there is no such statement in the routine body.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-19 14:37MIT License
756Coalesce/Concat need at least two argumentsFind user-defined routines and derived tables (views/materialized views) that have a subquery that contain an invocation of Coalesce or Concat function with just one argument. You should use the Coalesce and Concat functions correctly by invoking these with at least two arguments. If one invokes these functions with one argument, then the functions will return the input value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-08 11:49MIT License
757Perhaps Count(*) is wrongly usedFind user-defined routines and derived tables (views/materialized views) that have a subquery that invokes Count aggregate function like this - Count(*), uses outer join, and grouping. In case of grouping you do not want to get an answer that an empty group contains one member.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:40MIT License
758Perahaps Coalesce invocation is missing or Concat should be usedFind user-defined routines and derived tables (views/materialized views) that have a subquery that invokes || operator but does not use Coalesce function to ensure that the arguments are not NULL. In PostgreSQL expression value || NULL returns NULL. In order to get value as the result, one has to replace NULL with a value (empty string) by using, for instance, Coalesce function (an alternative is to use a CASE expression). Instead of || + Coalesce, one could use Concat, Concat_ws, or Format functions for the concatenation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-12-08 11:51MIT License
759A routine is invoked only onceFind user-defined routines that are invoked by exactly one user-defined routine.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-10 17:11MIT License
760The reference to a database operation is missing from a commentFind user-defined routines that comment does not contain a reference to a database operation that the routine implements. In case of routines that have been created based on the contracts of database operations, one should refer to the short identifier of the operation in the comment of the routine. The operation identifier must be in this case in the form OP, but other forms could be used as well.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:39MIT License