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...
501Numeric literals between apostrophesPlacing numeric literals between apostrophes will cause unnecessary type conversions. It could also be that the literal should indeed be textual but the problem is in choosing the values. For instance, table Occupation has column occupation_code with the type VARCHAR(3). However, all the values in the column consist of digits (for instance, 1, 2, 3). Thus, it would have been better to a) use SMALLINT as the column type or b) use different occupation codes that contain additional symbols to digits.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:20MIT License
502Perhaps incorrect use of 'NULL'Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:19MIT License
503Polymorphic 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
504SQL functions that use optimistic approach for locking but do not return a valueFind SQL functions that use a hidden column of PostgreSQL tables - xmin - to implement optimistic locking but do not return any information to the invoker of the functions, i.e., whether the update/delete operation succeeded or not. The functions should let their invokers know as to whether the function succeeded in updating or deleting a row.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 13:06MIT License
505Invalid character classPostgreSQL regular expressions do not have character classes word and letter.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:50MIT License
506Duplication of case insensitivity specification in a regular expressionFind regular expressions that use both case insensitive search operator ~* and case insensitivity modifier (?i).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:49MIT License
507Routines with type castingMake sure that your parameters have appropriate types in order to avoid unnecessary type casting.GeneralINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:42MIT License
508User-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
509Routines 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
510SECURITY 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
511Multiple selects from the same table in a routineCode should be as compact as possible and system should make as little work as necessary in order to solve a task. Thus, instead of selecting different fields of the same row with different SELECT INTO statements one should try to do it with one statement.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:10MIT License
512Explicit 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
513No point to have in a procedure COMMIT without ROLLBACK or vice versaIf you end transaction in a procedure, then there should be a possibility to either commit or rollback the transaction based on some condition. Procedures appeared in PostgreSQL 11.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 12:00MIT License
514User-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
515The use of xmin hidden column in views and routinesFind the number of views and materialized views that have a column with the xid type and the number of 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.Sofware measureINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:56MIT License
516PL/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
517Using 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
518Procedures 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
519The 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
520User-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