The list of all the queries

YELLING IN COMMENTS!

Query goal: Find comments of derived tables and routines that consist of only uppercase letters. Do not use only uppercase (capital) letters in order to write comments. It means yelling and also makes text less readable.
Notes about the query: Refers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. There could be multiple routines with the same name but with different parameters in the same schema (overloading). Thus, for the unique identification of the routine it is necessary to present also its parameters in addition to the schema name and routine name. The query does not consider the routines that are a part of an extension.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: High (Few or no false-positive results)
Query license: MIT License
Fixing suggestion: Write normal sentences. Use a mix of lowercase and uppercase in comments.
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT 
  n.nspname AS object_schema, 
  p.proname || '(' || pg_get_function_identity_arguments(p.oid)  || ')' AS object_name,
  CASE WHEN p.prokind='f' THEN 'FUNCTION'
  WHEN p.prokind='p' THEN 'PROCEDURE'
  WHEN p.prokind='a' THEN 'AGGREGATE FUNCTION'
  WHEN p.prokind='w' THEN 'WINDOW FUNCTION' END AS object_type,
  d.description AS comment
FROM 
  (pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid) 
  LEFT JOIN pg_catalog.pg_description d ON p.oid=d.objoid
WHERE 
   n.nspname NOT IN (SELECT schema_name
FROM INFORMATION_SCHEMA.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL) AND
p.proname NOT IN ('f_assume_you_must_use_files', 'f_check_format_comma_separated_list', 'f_check_password', 'f_default_value_with_no_match') AND NOT EXISTS (SELECT 1
FROM pg_catalog.pg_depend d 
WHERE EXISTS (SELECT 1 FROM pg_catalog.pg_extension e WHERE d.refobjid=e.oid) AND
d.objid=p.oid) AND Upper(d.description)= d.description
AND d.description~'[[:alpha:]]'
AND d.description!~'^[[:space:]]*TODO[[:space:]]*$'
UNION SELECT n.nspname AS object_schema, 
c.relname AS object_name, 
CASE WHEN c.relkind='v' THEN 'VIEW' ELSE 'MATERIALIZED VIEW' END AS object_type,
d.description AS comment
FROM pg_catalog.pg_class c JOIN pg_catalog.pg_authid u ON u.oid = c.relowner
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_catalog.pg_description d ON c.oid=d.objoid
WHERE c.relkind IN ('v', 'm') 
AND (n.nspname = 'public' OR u.rolname <> 'postgres') 
AND Upper(d.description)= d.description
AND d.description~'[[:alpha:]]'
AND d.description!~'^[[:space:]]*TODO[[:space:]]*$'
ORDER BY object_type, object_schema, object_name, comment;

Collections where the query belongs to

Collection nameCollection description
Find problems automaticallyQueries, 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 .

Categories where the query belongs to

Category nameCategory description
Comfortability of database evolutionQueries of this category provide information about the means that influence database evolution.
User-defined routinesQueries of this category provide information about the user-defined routines

The list of all the queries