The list of all the queries

Too short or missing comments of derived tables and routines

Query goal: Find views, materialized views, and user-defined routines that do not have a comment at all or the comment is shorter than twice the length of the object name, or the comment states that it is missing (TODO). You should give information to future developers and maintainers of the system (including the future version of yourself). Do not just repeat the name in the comment (with perhaps some rewording).
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 find comments of routines that are added to a database as a part of an extension.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: Medium (Medium number of false-positive results)
Query license: MIT License
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT CASE WHEN relkind='m' THEN 'MATERIALIZED VIEW' ELSE 'VIEW' END AS object_type,
n.nspname AS schema_name, c.relname AS object_name, 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 (d.description IS NULL 
OR char_length(c.relname)*2>=char_length(d.description) 
OR d.description~*'todo')
UNION SELECT 
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,
  n.nspname AS routine_schema, 
  p.proname || '(' || pg_get_function_identity_arguments(p.oid)  || ')' AS object_name,
  d.description AS comment
FROM 
  (pg_catalog.pg_proc p JOIN pg_catalog.pg_namespace n ON p.pronamespace = n.oid) JOIN pg_catalog.pg_language l ON p.prolang=l.oid
  LEFT JOIN pg_catalog.pg_description d ON p.oid=d.objoid
WHERE 
 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
   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 l.lanname IN ('sql','plpgsql') 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
(d.description IS NULL 
OR char_length(p.proname)*2>=char_length(d.description)
OR d.description~*'todo')
ORDER BY object_type, schema_name, object_name;

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.
CommentsQueries of this category provide information about comments to the database objects that have been registered in the system catalog.
Derived tablesQueries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer.
User-defined routinesQueries of this category provide information about the user-defined routines

Reference materials for further reading

Reference
https://blog.codinghorror.com/when-good-comments-go-bad/
https://blog.codinghorror.com/code-tells-you-how-comments-tell-you-why/
https://blogs.msdn.microsoft.com/ericlippert/2004/05/04/aargh-part-five-comment-rot/

The list of all the queries