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

AND
AND
AND
ANDFrom where does the query gets its information?
AND
AND

There are 961 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
361The number of SQL-language routines with different types of bodiesFind for each user schema that contain a SQL-language routine how many of these have the body that is string literal and how many have the body (possible starting from PostgreSQL 14) that is parsed at the routine definition time. Try to be consistent, i.e., use the same solution in case of all the routines.Sofware measureINFORMATION_SCHEMA+system catalog base tables2022-12-02 11:33MIT License
362Perhaps primary key columns could be renamedFind the names of simple primary key columns that name does not follow the pattern _id or _code but it is quite similar.Problem detectionsystem catalog base tables only2022-12-01 14:34MIT License
363Names of the password columnsFind names of columns of base tables, views, and materialized views that contain passwords. Make sure that the naming is consistent,GeneralINFORMATION_SCHEMA+system catalog base tables2022-11-30 15:04MIT License
364Columns that have the same name as their domain/typeFind the columns that name is the same as the name of the type of the column or the domain of the column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-30 13:04MIT License
365Do not clone columns"Split a base table column into multiple columns based on the values in some other column. Each such newly created column has the name, a part of which is a data value from the original tables."(Bill Karwin) Find base tables that have more than one columns with the same type and field size and the difference between the columns are the year or month number at the end of the column name (two or four numbers, preceded by an underscore).Problem detectionINFORMATION_SCHEMA only2022-11-28 15:15MIT License
366Columns that have the same name as some domain/typeUse different names to avoid confusion.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-28 14:47MIT License
367A setter does not update a tableFind user-defined non-trigger SQL and PL/pgSQL routines that name starts with "set" (but not with "setting") but do not contain a UPDATE statement.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-27 18:35MIT License
368Do 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
369Frequency of table name lengths based on the table typeFind in case of base tables, materialized views, and views the number of tables based on the length of the table name.Sofware measureINFORMATION_SCHEMA+system catalog base tables2022-11-23 01:09MIT License
370Frequency of column name lengths based on the table typeFind in case of base tables, materialized views, and views the number of columns based on the length of the column name.Sofware measureINFORMATION_SCHEMA+system catalog base tables2022-11-22 14:43MIT License
371Potential duplication of sequence generatorsDo not create unnecessary sequence generators.Problem detectionINFORMATION_SCHEMA only2022-11-21 11:01MIT License
372The name of the routine does not match with the action of the routineFind user-defined non-trigger SQL and PL/pgSQL routines where the beginning of the name of the routine indicates a certain action inside the routine (INSERT, UPDATE, or DELETE) but there is no such statement in the routine body.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-19 14:37MIT License
373Names of the columns of derived tables that have been given by the systemFind columns of derived tables that name has been given by the system. The creators of the table should specify the name themselves to avoid ugly names and nasty surprises.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-15 16:48MIT License
374Constraints with the same name within the same schema and constraint typeFind names of foreign key constraints that are used within the same schema more than once. Find names of check constraints that are used within the same schema more than once. Find names of constraint triggers that are used within the same schema more than once. Different things should have different names. But here different constraints have the same name. Also make sure that this is not a sign of duplication.Problem detectionsystem catalog base tables only2022-11-15 16:43MIT License
375Table constraints with the same name (constraints connected directly with a base table or a foreign table)Find base table and foreign table constraint names that are used in a database more than once (possibly in different schemas or in case of different types of constraints). Different things should have different names. But here different constraints have the same name. Also make sure that this is not a sign of duplication.Problem detectionsystem catalog base tables only2022-11-15 16:43MIT License
376Prefixes of base table namesFind base tables that name starts with a prefix. Do not use prefixes in case of base table names. Derive the names from the names of entity types. Do not use "_", "t_", "tab_", "t11_" etc as prefixes of a table.Problem detectionINFORMATION_SCHEMA only2022-11-15 16:32MIT License
377Inconsistent naming of comment columnsFind columns of tables that start with the word comment or komment but end differently (excluding numbers). Return result only if there is more than one naming variant of such columns in the database. For instance, a column has the name "comment" but another "comments".Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-15 14:09MIT License
378Gratuitous context in the names of non-foreign key and non-candidate key columnsFind the names on base table columns that are not a part of a candidate key and a foreign key and that contain the name of the table. Exclude very general column names (for instance, nimi, nimetus, kommentaar, kirjeldus, name, comment, description). In case of these using the table name in the column name is not a problem because it simplifies writing the queries based on the tables. In this case one does not have to rename the columns in the query result.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-15 13:39MIT License
379Table inheritance (path view)Find in case of each base table that participates in a table inheritance hierarchy the path to the table from the top-level table. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. Also make sure that the identifier of each child table in an inheritance hierarchy is a hyponym of the identifier of its parent table.Generalsystem catalog base tables only2022-11-13 16:13MIT License
380Patterns of the Boolean expressions of simple CHECK constraintsFind patterns of the Boolean expressions of simple CHECK constraints (involve only one column). Do not solve the same task in different places differently. The same rule could be implemented with CHECK constraints that have different Boolean expressions. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)GeneralINFORMATION_SCHEMA+system catalog base tables2022-11-13 16:06MIT License