The list of all the queries

All domain default values

Query goal: Find domains that specify a default values and columns that are defined based on the domain. Make sure that there are no unsuitable default values.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT domain_schema, domain_name , domain_default, string_agg(table_schema || '.' || table_name || '.' || column_name, ';<br>' ORDER BY table_schema, table_name) AS columns
FROM information_schema.columns c
RIGHT JOIN information_schema.domains d USING (domain_schema, domain_name)
INNER JOIN information_schema.schemata s
ON d.domain_schema=s.schema_name
WHERE  d.domain_default IS NOT NULL
AND (d.domain_schema = 'public'
OR s.schema_owner<>'postgres')
GROUP BY domain_schema, domain_name , domain_default
ORDER BY domain_schema, domain_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
Default valueQueries of this catergory provide information about the use of default values.
DomainsQueries of this category provide information about reusable specifications of column properties.

The list of all the queries