The list of all the queries

Too generic names (domain constraints)

Query goal: Find domain CHECK constraints that have a too generic name - for instance, the name contains word "data" ) or the name is an abbreviation of the constraint type name (for instance, "chk" or "chk1").
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: High (Few or no false-positive results)
Query license: MIT License
Fixing suggestion: Rename the constraints.
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT
domain_schema, 
domain_name,
constraint_name AS suspected_constraint_name 
FROM INFORMATION_SCHEMA.domain_constraints
WHERE 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)
AND ((constraint_name~*'(andmed|_data|info|veerg|column|kitsendus|piirang|constraint|restriction)' 
AND constraint_name!~*'database')
OR constraint_name~*'^(_){0,1}(ck|chk)(_|[[:digit:]])*$')
ORDER BY domain_schema, domain_name, constraint_name;

Collections where the query belongs to

Collection nameCollection description
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 where the query belongs to

Category nameCategory description
CHECK constraintsQueries of this category provide information about CHECK constraints.
DomainsQueries of this category provide information about reusable specifications of column properties.
NamingQueries of this category provide information about the style of naming.

The list of all the queries