Seq nr | Name | Goal | Type | Data source | Last update▼ | License | ... |
---|---|---|---|---|---|---|---|
481 | Incorrect characterization of a user-defined routine as an "immutable" routine | Find immutable routines that contain SELECT statements from a database (including SELECT .. FOR UPDATE), INSERT, UPDATE, DELETE, or LOCK statement. The DBMS should get a correct background information about the behaviour of a routine. Immutable routines should not have side effects and should also not ask data from a database because it could change over time. Immutable routines cannot lock tables or its specific rows. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 14:08 | MIT License | |
482 | Incorrect characterization of a user-defined routine as a "stable" routine | Find stable routines that contain INSERT, UPDATE, DELETE, SELECT … FOR UPDATE, or LOCK statement. The DBMS should get a correct background information about the behaviour of a routine. Stable routines cannot modify data in a database, lock tables, or its specific rows. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 13:59 | MIT License | |
483 | Using routine name in front of a parameter name in a routine body to refer to the parameter of the routine | Write 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 detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 13:40 | MIT License | |
484 | User-defined routines that use positional references to parameters | Use parameter names instead of positional references to improve code evolvability. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 13:18 | MIT License | |
485 | Unused named input parameters | Find named input parameters that are not referenced in the routine body. All the parameters that are presented in the routine signature declaration must be used in its body. Otherwise these are dead code elements. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 13:03 | MIT License | |
486 | Middle-man | Find a routine that's only task is to invoke another routine. If a routine performs only one action, delegating work to another routine, why does it exist at all? | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 12:48 | MIT License | |
487 | Routines without an action | Find routines that body does not contain any action. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 12:14 | MIT License | |
488 | Perhaps a routine does not have a real task | Find the routines where the only action is to return an argument value, a constant value, NULL or return the value of OLD or NEW variable in case of trigger functions. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 12:09 | MIT License | |
489 | Duplicate user-defined routines | Find user-defined routines with the exact duplicate body and parameters. There should not be multiple routines with exactly the same body and parameters (name, type). Having such duplicates is redundancy. Do remember that the same task can usually be solved in multiple different ways. Thus, the exact copies of routine bodies are not the only possible duplication. Moreover, it could be that different routines that solve the same task have different parameter names (but the parameters have the same types, ordinal positions, default values or the routines have different order of parameters). Thus, the query does not find all the duplications. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-05 11:59 | MIT License | |
490 | The total number of physical lines of code in the bodies of user-defined SQL and PL/pgSQL functions/procedures | Find a numerical measure that describes the extent of the database public interface (virtual data layer) through which users access the database. | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 21:02 | MIT License | |
491 | Routine body only in uppercase | Uppercase means screaming and having code entirely in uppercase makes its reading more difficult. On the other hand, it would be a good idea to have keywords in uppercase. Find routines that body contains a SQL data manipulation statement (which shouldn't be entirely in uppercase) but still the body is completely in uppercase. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 20:12 | MIT License | |
492 | Do not refer to the table schema in the references to columns | Find 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 detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 17:32 | MIT License | |
493 | Function in a function-based index of a column is different of the function that is used in the query in a routine based on the column | Create appropriate indexes to speed up queries. If you apply a function to a column in a query, then create a function-based index based on the function to the column. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 17:26 | MIT License | |
494 | There is no reason to use PL/pgSQL if you do not use one or more features of a procedural language | Using PL/pgSQL may cause context switching between declarative SQL and procedural PL/pgSQL. Thus use PL/pgSQL only if you truly need some of its constructs (variables, conditional statements, cycles, cursors, exception handling). | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 16:32 | MIT License | |
495 | Perhaps a regular expression could be simplified | Find regular expressions that name character classes a-zA-Z. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 16:19 | MIT License | |
496 | Routines with INSERT statements that are sensitive towards the order of columns | INSERT statements shouldn't be sensitive towards the order of columns. If one changes the order of columns in a table then these statements must be rewritten. Otherwise the code will not work or works incorrectly. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 16:15 | MIT License | |
497 | Invalid use of the case insensitive search modifier in regular expressions | Find regular expression patterns that use (?i) modifier in any other place than at the beginning of the pattern or (?-i) in any place of the pattern. Such use of the modifiers is not supported by PostgreSQL. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 16:06 | MIT License | |
498 | SELECT * in a routine body | SELECT statement should list the columns not use SELECT * to return data from all the columns. Firstly, it ensures, that the query asks only data that is really needed by the routine. It means less data that the DBMS has to fetch and pass to the routine. It could also mean that the DBMS can answer to a query based on an index without reading table blocks. Secondly, it documents the data that is returned by the query. The query does not consider objects that are a part of an extension. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 15:03 | MIT License | |
499 | Pointlessly returned value | The value that is returned by a function should depend on something. If you do not have anything meaningful to return (for instance, the function always returns true, false, NULL, or the same number), then write VOID instead of the return type. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 15:01 | MIT License | |
500 | Names of character classes are not in the lowercase | Find regular expressions where the names of character classes are not completely in lowercase. For instance, incorrect is to write [[:UPPER:]] or [[:Upper:]] and correct is [[:upper:]]. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | 2021-11-04 13:22 | MIT License |