Goal | 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. |
Notes | Refers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. In the returned body of routine the query replaces each newline character with the line break (br) tag for the better readability in case the query result is displayed in a web browser. The query does not consider the routines that are a part of an extension. The query condition does not use the keyword SELECT because a function might contain only on SELECT statement without FROM clause where the task of the statement is to calculate a value based on the input. For instance, the following statement can be used to calculated temperature on the Celsius scale from the temperature on the Fahrenheit scale: SELECT ROUND((($1 - 32.0) * 5.0 / 9.0),3); It could be the only statement within the body of a SQL function. The query does not consider routines with SQL-standard bodies, which are permitted starting from PostgreSQL 14. Such routine is parsed at routine definition time, and the uppercase identifiers are replaced at that time. |
Type | Problem detection (Each row in the result could represent a flaw in the design) |
Reliability | Low (Many false-positive results) |
License | MIT License |
Fixing Suggestion | Write only keywords in completely uppercase. |
Data Source | INFORMATION_SCHEMA+system catalog |
SQL Query |
|
This query belongs to the following collections:
Name | Description |
---|---|
Find problems automatically | Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not . |
This query is classified under the following categories:
Name | Description |
---|---|
Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
Does not work in some earlier PostgreSQL version | Queries of this category provide information that was not available in some earlier PostgreSQL version |
User-defined routines | Queries of this category provide information about the user-defined routines |