The list of all the queries

Comments of columns

Query goal: Find all comments of columns of tables.
Notes about the query: The query excludes columns of system catalog tables.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: system catalog only
SQL query: Click on query to copy it

SELECT n.nspname AS table_schema, 
c.relname AS table_name, 
a.attname AS column_name, 
CASE WHEN c.relkind='r' THEN 'BASE TABLE'
WHEN c.relkind='v' THEN 'VIEW'
WHEN c.relkind='m' THEN 'MATERIALIZED VIEW'
WHEN c.relkind='f' THEN 'FOREIGN TABLE'
WHEN c.relkind='p' THEN 'PARTITIONED TABLE'
END AS table_type,
d.description
FROM pg_description AS d INNER JOIN pg_class AS c
ON d.objoid=c.oid
INNER JOIN pg_attribute AS a
ON c.oid=a.attrelid AND d.objsubid=a.attnum
INNER JOIN pg_namespace AS n
ON n.oid=c.relnamespace INNER JOIN pg_authid AS au ON n.nspowner=au.oid
WHERE (n.nspname='public' OR au.rolname<>'postgres')
ORDER BY table_schema, table_name, a.attnum;

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 .

Categories where the query belongs to

Category nameCategory description
CommentsQueries of this category provide information about comments to the database objects that have been registered in the system catalog.

The list of all the queries