The list of all the queries

Comments of routines

Query goal: Find comments of user-defined routines (functions or procedures) that are registered in the system catalog witht a COMMENT statement. Make sure that the comments give relevant, useful, and correct information.
Notes about the query: Refers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. The query does not find comments of routines that are added to a database as a part of an extension. 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.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT 
  n.nspname AS routine_schema, 
  p.proname AS routine_name,
 pg_get_function_identity_arguments(p.oid) AS parameters,
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 routine_type,
  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 
   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
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)
ORDER BY n.nspname, p.proname, parameters, d.description NULLS LAST;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .
Lexicon bad smells and linguistic antipatternsQueries made to find the occurrences of lexicon bad smells and linguistic antipatterns

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.
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/
https://www.postgresql.org/docs/current/sql-comment.html

The list of all the queries