The list of all the queries

Tables without columns

Query goal: Do not have in a database elements that are not useful. PostgreSQL permits tables with no columns. Such tables can be used to implement Boolean variables (tables TABLE_DEE and TABLE_DUM). On the other hand, such tables might be a result of database evolution, where developers have not noticed that they have dropped all the columns of a table or have not noticed that they have created such a table in the first place.
Notes about the query: The query considers only columns that are visible to the database user and not hidden system columns.
Query type: Problem detection (Each row in the result could represent a flaw in the design)
Query reliability: Low (Many false-positive results)
Query license: MIT License
Fixing suggestion: If the table was not created intentionally, then add a column or drop the table.
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT table_schema, table_name, table_type
FROM INFORMATION_SCHEMA.tables AS t
WHERE NOT EXISTS (SELECT 1
FROM INFORMATION_SCHEMA.columns AS c
WHERE t.table_schema=c.table_schema 
AND t.table_name=c.table_name)
UNION SELECT nspname, relname, 'MATERIALIZED VIEW' AS table_type
FROM pg_class AS c INNER JOIN pg_namespace AS n ON c.relnamespace=n.oid
WHERE NOT EXISTS (SELECT 1
FROM pg_attribute AS a
WHERE c.oid=a.attrelid)
ORDER BY table_schema, table_name, table_type;

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
StubsQueries of this catergory provide information about stubs (piece of code used to stand in for some other programming functionality).

Reference materials for further reading

Reference
https://blog.jooq.org/2017/03/17/creating-tables-dum-and-dee-in-postgresql/

The list of all the queries