The list of all the queries

Deferrable constraints

Query goal: Find all deferrable constraints.
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 target_schema as table_schema, target_table as table_name, a.attname as column_name, 
conname AS constraint_name, 
CASE WHEN contype='f' THEN 'FOREIGN KEY'
WHEN contype='p' THEN 'PRIMARY KEY' 
WHEN contype='u' THEN 'UNIQUE'
WHEN contype='t' THEN 'CONSTRAINT TRIGGER'
WHEN contype='c' THEN 'CHECK'
ELSE 'EXCLUSION' END AS constraint_type,
condeferrable AS is_deferrable,
condeferred AS is_deferred
from (select 
(select nspname from pg_namespace where oid=m.relnamespace) as target_schema,
m.relname as target_table, 
m.oid as target_table_oid,
conname,
contype,
condeferrable,
condeferred,
unnest(o.conkey) AS target_col
from pg_constraint o inner join pg_class c on c.oid = o.conrelid
inner join pg_class m on m.oid = o.conrelid
where o.conrelid in (select oid from pg_class c where c.relkind = 'r')
and (condeferrable=true or condeferred=true)) t
inner join pg_attribute a on t.target_col = a.attnum and t.target_table_oid = a.attrelid and a.attisdropped = false
order by target_schema, target_table, attname;

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
CHECK constraintsQueries of this category provide information about CHECK constraints.
Relationships between tablesQueries of this category provide information about how database tables are connected to each other and whether such connections have been explicitly defined and whether it has been done correctly.
TransactionsQueries of this catergory provide information about the use of transactions.
UniquenessQueries of this category provide information about uniqueness constraints (PRIMARY KEY, UNIQUE, EXCLUDE) as well as unique indexes.

Reference materials for further reading

Reference
https://begriffs.com/posts/2017-08-27-deferrable-sql-constraints.html

The list of all the queries