Goal Find the names of domain CHECK constraints that have been system-generated. Names should follow the same style. If there is a mix of system-generated and user-defined names, then the style is most probably different.
Type Problem detection Each row in the result could represent a flaw in the design
Reliability Unspecified The query is not used for detecting flaws or the reliability is unknown
License MIT (opens in new tab)
Data Source INFORMATION_SCHEMA only
SQL Query
SELECT domain_schema, domain_name, constraint_name
FROM INFORMATION_SCHEMA.domain_constraints
WHERE constraint_name ILIKE domain_name || '_check%' AND
domain_schema NOT IN (SELECT schema_name
FROM INFORMATION_SCHEMA.schemata
WHERE schema_name<>'public' AND
schema_owner='postgres' AND schema_name IS NOT NULL)
ORDER BY domain_schema, domain_name;

Collections

This query belongs to the following collections:

Find problems automatically

Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .

NameDescription
Find problems automaticallyQueries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .

Categories

This query is classified under the following categories:

Domains

Queries of this category provide information about reusable specifications of column properties.

Naming

Queries of this category provide information about the style of naming.

NameDescription
DomainsQueries of this category provide information about reusable specifications of column properties.
NamingQueries of this category provide information about the style of naming.