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...
41Extension routines in the schema "public"Find extensions that routines are in the schema public.Generalsystem catalog base tables only2024-01-04 11:56MIT License
42Insufficient number of user-defined triggers+rulesThere must be user-defined triggers and/or rules for at least n (three in this case) tasks in the database. It also means that one should create at least three triggers and/or rules in the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-04 11:47MIT License
43Insufficient number of user-defined triggers+rules (based on number of tasks)There must be user-defined triggers and/or rules for at least n (three in this case) tasks in the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-04 11:46MIT License
44Different tasks of triggersFind different tasks that are solved by using triggers, i.e., different triggers on the same table or different tables that do the same thing are considered to solve one task.GeneralINFORMATION_SCHEMA+system catalog base tables2024-01-04 00:53MIT License
45Columns with BOOLEAN type that do have a good nameThe prefic of the name should be "is_" or "has_" or "can_" (in English) or "on_" (in Estonian). Worse: agreed, kinnitatud. Better: is_agreement, on_kinnitatud.GeneralINFORMATION_SCHEMA+system catalog base tables2024-01-03 09:56MIT License
46Columns with BOOLEAN type that do not have a good nameThe phrase "is_" or "has_" or "can_" (in English) or "on_" (in Estonian) should be used in the name - preferably in the beginning. Worse: agreed, kinnitatud. Better: contract_is_agreed, leping_on_kinnitatud. Perhaps the best: is_contract_agreed or is_agreement, on_leping_kinnitatud, on_kinnitatud.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-03 09:56MIT License
47Inconsistent naming of columns with BOOLEAN typeFind as to whether some columns with the type Boolean start with a prefix ("is", "has", "can", "on") and some do not.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-03 09:54MIT License
48Names of columns with the type BOOLEANThe naming of BOOLEAN columns must be consistent. For the better readability the names of such columns could have prefix "is_" (in English) or "on_" (in Estonian)GeneralINFORMATION_SCHEMA+system catalog base tables2024-01-03 09:41MIT License
49Perhaps the type of a base table column should be BOOLEAN (based on column names)Find base table columns that based on the name seem to hold truth values. Find columns that name starts with "is_" or "has_" or "can_" or "on_" and that do not have Boolean type.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-03 09:41MIT License
50Perhaps the type of a parameter should be BOOLEAN (based on parameter names)Find routine parameters that based on the name seem to hold truth values. Find parameters that name starts with "is_" or "has_" or "can_" or "on_" and that do not have Boolean type.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-03 00:10MIT License
51Base table columns permitting empty strings and strings that consist of only whitespace characters (2)Find non-foreign key columns of base tables that have a textual type and do not have a simple CHECK constraint (i.e., a constraint that involves only one column) that seems to prohibit empty strings and strings that consist of only whitespace as well as a simple CHECK constraint that specifies permitted symbols.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-02 16:52MIT License
52Perhaps too many subconditions in a CHECK constraintFind check constraints of base table and foreign table columns that are either associated with more than one column and have at least one AND operation or are associated with exactly one column and have two or more AND operations.Problem detectionINFORMATION_SCHEMA only2024-01-01 12:23MIT License
53Perhaps incorrect column name (based on default values)Find columns of base tables that have the default value CURRENT_USER or SESSION_USER but the name of the column does not refer to the fact that it contains usernames.Problem detectionINFORMATION_SCHEMA only2024-01-01 12:14MIT License
54Simple check constraints with multiple tasksFind simple check constraints, i.e., check constraints that cover one column that seem to have multiple tasks. The corresponding code smell in case of cleaning code is "G30: Functions Should Do One Thing". (Robert C. Martin, Clean Code)Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-01 11:42MIT License
55All table CHECK constraints that cover at leat one columnFind all CHECK constraints (except NOT NULL) that are associated with a base table or a foreign table column. It is useful to enforce as many constraints at database level as possible. In this way one improves data quality as well as gives extra information to the database users (including the DBMS engines, development environments, and applications).GeneralINFORMATION_SCHEMA only2024-01-01 11:27MIT License
56Perhaps is not snake_case - id, code, key, or nr is not preceded by an underscoreFind names that perhaps do not use the snake_case naming style because the name ends with the phrase "id", "uuid", "code", "kood", "key", or "nr" that is not preceded by an underscore. Prefer snake_case over PascalCase and camelCase in names.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-31 11:17MIT License
57Multiple tables share the same state classifierFind cases where multiple tables share the same state classifier. For each main entity type one should create a separate state classifier table. Even if the classifier values are the same in case of two entity types for now these may become different in the future. Having a shared state classifier table usually means very simplistic state machines (states active and inactive) that could point to the gaps in analysis.Problem detectionsystem catalog base tables only2023-12-30 15:51MIT License
58Perhaps last update time trigger is missingFind base tables that have a column for last update time but the table does not have associated before update row level trigger for changing the last update time.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 15:22MIT License
59Perhaps an overcomplicated constraint expression that compares the result of a Boolean expression with a Boolean valueFind table and domain CHECK constraints that compare the result of a Boolean expression with a Boolean value. If you can choose between two logically equivalent Boolean expressions choose the more simple expression.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 11:57MIT License
60Inconsistent use of session_user and current_user functionsFind as to whether both functions session_user and current_user are used in the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-30 11:37MIT License