Catalog of PostgreSQL queries for finding information about a PostgreSQL database and its design problems

AND
AND
ANDQueries of this catergory provide information about storing hierarchical data in the database.
ANDFrom where does the query gets its information?
AND
AND

There are 11 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
1Columns with JSON, JSONB, or XML typeFind columns with JSON, JSONB, or XML type. Each columns should have the most appropriate data type.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-19 17:01MIT License
2Cycle in a hierarchyThere should not be cycles in hierarchies meaning that the parent must always be specified. In this case a parent must reference to a child or to itself, otherwise it cannot be registered.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
3Derived tables that present data in json or xml formatFind views and materialized views that present data in json or xml format. Instead of recording data in this format in base tables one could generate the data value on the fly based on data that has been recorded in base tables.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
4Do not always depend on one's parentFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table.Generalsystem catalog base tables only2021-03-12 15:36MIT License
5Do not always depend on one's parent - column names are ot sufficiently differentFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four).Problem detectionsystem catalog base tables only2022-11-26 17:19MIT License
6Do not always depend on one's parent (INFORMATION_SCHEMA)Find where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list.GeneralINFORMATION_SCHEMA only2021-03-07 10:57MIT License
7JSON type instead of JSONB type"In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys." (https://www.postgresql.org/docs/current/datatype-json.html)Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
8ON DELETE SET NULL is probably missingFind implementations of the adjacency list design pattern, where the corresponding foreign key columns are optional but the foreign key constraint does not have ON DELETE SET NULL compensating action. Implement adjacency list correctly.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
9Perhaps a relationship should be irreflexiveEnforce all the constraints. A binary relation is called irreflexive, if it does not relate any element to itself.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
10Recursive relationships with the same source and targetFind incorrectly implemented adjacency lists.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
11The number of derived table columns with an array, a user-defined, XML, JSON, or JSONB typeFind the number of derived table columns with json, xml, array, or user-defined types. Such columns may contain data that has been aggregated/composed based on values in base tables.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-01-14 20:22MIT License