The list of all the queries

Domain name contains base table name

Query goal: Find names of domains that contain the name of the table that column the domain specifies. Domains are reusable artifacts that one should be able to use in case of different base tables. Thus, it is inappropriate to use the name of a particular table in the name of the domain.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: Medium (Medium number of false-positive results)
Query license: MIT License
Fixing suggestion: Rename the domain and make the name more general.
Data source: INFORMATION_SCHEMA only
SQL query: Click on query to copy it

SELECT c.table_schema, c.table_name, c.column_name,  c.data_type, c.domain_schema, c.domain_name
FROM information_schema.columns AS c 
WHERE (c.table_schema, c.table_name) IN (SELECT table_schema, table_name
FROM INFORMATION_SCHEMA.tables WHERE table_type='BASE TABLE') 
AND c.table_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 c.table_name ILIKE '%' || c.domain_name || '%'
ORDER BY c.table_schema, c.table_name, c.ordinal_position;

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
DomainsQueries of this category provide information about reusable specifications of column properties.
NamingQueries of this category provide information about the style of naming.

Reference materials for further reading

Reference
The corresponding code smell in case of cleaning code is "N2: Choose Names at the Appropriate Level of Abstraction". (Robert C. Martin, Clean Code)

The list of all the queries