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 996 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
961User-defined routines that implement UPSERT operationFind user-defioned routines that implement UPSERT operation. Make sure that it is consistent with the contracts of database operations.GeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 17:02MIT License
962User-defined routines that produce a temporary tableFind user user-defined routines that produce a temporary tableGeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:25MIT License
963User-defined routines that read dataFind user-defined routines that contain SELECT … FROM or PERFORM … FROM operations. PostgreSQL uses multiversion concurrency control (MVCC). Therefore, SELECTs do not block modifications and vice versa. One has to take steps to achieve correct behaviour of data access code. In addition, one should not ask data with multiple queries if it is possible to achieve the result with only one query.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-21 15:00MIT License
964User-defined routines that use dynamic SQL to execute data manipulation statementsFind user-defined routines that use dynamic SQL to execute data manipulation statements (SELECT, INSERT, UPDATE, DELETE).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:39MIT License
965User-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
966User-defined routines that use md5 hash for other purposes than generating test dataFind user-defined routines that use md5 hashes for the security purposes. Nowadays such hashes can be calculated too quickly and its use should be avoided at least for hashing passwords. Exclude routines that invoke both md5 function and generate_series function and are thus probably used to generate test data.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-31 15:23MIT License
967User-defined routines that use positional references to parametersUse parameter names instead of positional references to improve code evolvability.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 13:18MIT License
968User-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
969User-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
970User-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
971User-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
972Username is not uniqueFind textual columns that potentially contain usernames (including columns that potentially contain e-mail addresses) that do not have a unique constraint or a unique index that involves only this column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
973Using AFTER triggers to enforce constraintsDo not let the system to do extra work. Checking a constraint with an AFTER trigger means that the trigger procedure will be executed after the data modification and if the check fails, then the system has to do extra work to roll back the changes.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
974Using an internal data type - nameFind base table columns that use type name that is used in system catalog tables. It is not a problem if the column is meant for recording identifiers of database objects.GeneralINFORMATION_SCHEMA only2021-03-30 13:36MIT License
975Using BEFORE triggers to log data changesDo not let the system to do extra work. Logging changes with a BEFORE trigger means extra work for rolling back the changes in case the logged data modification fails.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
976Using conditionals to determine the returned valueUse SQL language instead of PL/pgSQL where possible. Instead of using an IF statement, you can check as to whether the data modification succeeded or not by using the RETURNING clause in the data modification statement.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:52MIT License
977Using in some way reserved (in PostgreSQL) SQL keywords as the names of a database object (aggregate view)"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should not cause confusion. Find the distinct names (identifiers) of user-defined objects that are SQL keywords that are not completely unreserved in PostgreSQL, i.e., these either never cannot be used as regular identifiers or cannot be used in case of some type of database objects. In PostgreSQL "there are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. " (PostgreSQL manual) Moreover, such identifiers are often too general, i.e., do not provide enough information about the named object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-12-21 17:17MIT License
978Using in some way reserved (in PostgreSQL) SQL keywords as the names of a database object (detailed view)"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should not cause confusion. Find the names (identifiers) of user-defined objects that are SQL keywords that are not completely unreserved in PostgreSQL, i.e., these either never cannot be used as regular identifiers or cannot be used in case of some type of database objects. In PostgreSQL "there are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. " (PostgreSQL manual) Moreover, such identifiers are often too general, i.e., do not provide enough information about the named object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-12-21 17:21MIT License
979Using 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
980Using system-defined names of constraints (constraints that involve more than one column)Find the constraint types in case of which there exists system-defined names.Problem detectionsystem catalog base tables only2023-01-10 14:53MIT License