The list of all the queries

Domains that are associated with a sequence generator

Query goal: Domains are reusable artifacts. By associating a domain with a sequence generator, one essentially starts to share sequence generators between tables. It may cause a potential performance bottleneck by having a shared resource. By having a shared sequence it is not possible to change properties of sequences of different tables independently, i.e., it increases coupling between tables.
Notes about the query: In case of the string_agg function, the line break (br) tag is used as a part of the separator for the better readability in case the query result is displayed in a web browser.
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: Do not associate a sequence generator with a domain. Use for each table a separate sequence generator.
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 ILIKE '%nextval%'
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 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
Comfortability of data managementQueries of this category provide information about the means that have been used to make the use or management of database more comfortable and thus, more efficient.
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.
PerformanceQueries of this category provide information about indexes in a database.
Sequence generatorsQueries of this category provide information about sequence generators and their usage.

The list of all the queries