The list of all the queries

Base table columns with CITEXT type

Query goal: Find base table columns with CITEXT type and make sure that case insensitivity is really needed in case of this column.
Notes about the query: The query takes into account a possibility that the type may be associated with the column through a domain.
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,
at.attname AS column_name
FROM pg_attribute at INNER JOIN pg_class c ON at.attrelid=c.oid
INNER JOIN pg_namespace AS n ON n.oid=c.relnamespace
INNER JOIN pg_authid AS a ON n.nspowner=a.oid
INNER JOIN pg_type AS t ON at.atttypid=t.oid
LEFT JOIN pg_type AS dt ON t.typbasetype=dt.oid
WHERE (nspname='public' OR rolname<>'postgres')
AND (t.typname='citext' OR dt.typname='citext')
AND c.relkind='r' 
AND at.attisdropped='f'
AND at.attnum>0
ORDER BY table_schema, table_name, column_name;

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
Data typesQueries of this category provide information about the data types and their usage.

Reference materials for further reading

Reference
https://www.postgresql.org/docs/current/citext.html

The list of all the queries