The list of all the queries

Derived tables that have a column with the xid type

Query goal: Find the derived tables (views and materialized views) that have a column with the xid type, i.e., these use the data from the hidden xmin column of a base table. If one uses optimistic approach for dealing with the concurrent data modifications, then xmin values should be presented by views and used in routines that modify or delete rows.
Notes about the query: In the returned body of subquery of view/materialized view the query replaces each newline character with the line break (br) tag for the better readability in case the query result is displayed in a web browser.
Query type: General (Overview of some aspect of the database.)
Query license: MIT License
Data source: INFORMATION_SCHEMA+system catalog
SQL query: Click on query to copy it

SELECT 
table_schema, 
table_name,
column_name,
'VIEW' AS type,
regexp_replace(view_definition,'[\r\n]','<br>','g') AS view_definition
FROM 
information_schema.views AS v INNER JOIN information_schema.columns AS c
USING (table_schema, table_name)
WHERE 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.data_type='xid'
UNION SELECT nspname, relname, attname,
'MATERIALIZED VIEW' AS type,
regexp_replace(pg_get_viewdef(pg_class.oid),'[\r\n]','<br>','g') AS view_definition
FROM pg_class INNER JOIN pg_namespace ON pg_class.relnamespace=pg_namespace.oid
INNER JOIN pg_attribute ON pg_class.oid=pg_attribute.attrelid INNER JOIN pg_type ON
pg_attribute.atttypid=pg_type.oid
WHERE relkind = 'm' AND attnum>=1 AND attisdropped='f' AND typname='xid'
ORDER BY table_schema, table_name, type;

Collections where the query belongs to

Collection nameCollection description
Find problems by overviewQueries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not .

Categories where the query belongs to

Category nameCategory description
Concurrency controlQueries of this category provide information about concurrency control.
Derived tablesQueries of this category provide information about the derived tables (views, materialized views), which are used to implement virtual data layer.

Reference materials for further reading

Reference
https://momjian.us/main/blogs/pgblog/2017.html#October_4_2017
https://vladmihalcea.com/a-beginners-guide-to-database-locking-and-the-lost-update-phenomena/
https://www.2ndquadrant.com/en/blog/postgresql-anti-patterns-read-modify-write-cycles/
https://devcenter.heroku.com/articles/postgresql-concurrency

The list of all the queries