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

AND
AND
ANDQueries of this category provide information about triggers and rules in a database.
ANDFrom where does the query gets its information?
AND
AND

There are 85 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
1A large number of triggersShow user-defined triggers if there are more than 9 different trigger routine bodies, i.e., different triggers on different tables that do the same thing count as one trigger.GeneralINFORMATION_SCHEMA+system catalog base tables2023-12-25 11:23MIT License
2All event triggersFind event triggers, which are not associated to a specific schema object.Generalsystem catalog base tables only2020-12-24 14:54MIT License
3All rulesFind user-defined rules for rewriting data manipulation language statements. Rules should be used only for the tasks that cannot be achieved in a declarative manner, i.e., for example, by declaring a constraint.Generalsystem catalog base tables only2023-12-22 12:30MIT License
4All user triggers that are associated with tablesFind user-defined triggers that react to data modifications in tables. Triggers should be used only for the tasks that cannot be achieved in a declarative manner, i.e., by declaring a constraint. Triggers of the same table with the same event_manipulation, action_timing, and action_orientation are sorted based on the trigger name. This is the order of execution of triggers.GeneralINFORMATION_SCHEMA+system catalog base tables2021-01-19 11:27MIT License
5AND takes precedence over ORMake sure that Boolean expressions take into account precedence rules of Boolean operators. AND operator has precedence over OR operator.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
6Database objects of the same type and case insensitive name in the same containerFind database objects with the same type and case insensitive name in the same container. It can only happen if some of the names are case insensitive and others are case sensitive. For instance, the same schema can contain the table "Client" and clientProblem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 10:13MIT License
7Different tasks of rulesFind different tasks that are solved by using rules, i.e., different rules on the same table or different tables that do the same thing are considered to solve one task.Generalsystem catalog base tables only2024-01-14 16:10MIT License
8Different 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
9Disabled rulesIdentify disabled rules. These should be enabled or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2022-10-21 11:22MIT License
10Disabled system triggers (i.e., disabled enforcement of constraints)These triggers should be enabled because otherwise some important functionality regarding constraints like enforcing referential integrity does not work.Problem detectionsystem catalog base tables only2021-03-12 15:06MIT License
11Disabled user triggersIdentify disabled triggers. These should be enabled or dropped, otherwise these are dead code.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
12Double negatives in Boolean expressionsWrite code that is simple to understand and not confusing. A double negative is a grammatical construction occurring when two forms of negation are used in the same expression (https://en.wikipedia.org/wiki/Double_negative). Double negatives in Boolean expressions make it more difficult to understand and maintain the code.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
13Double negatives in regular expressionsFing regular expression patterns that use [^\S] instead of \s or [^\D] instead of \d or [^\W] instead of \w.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-09 12:01MIT License
14Duplicate rulesFind multiple rules with the same definition (event, condition, action) on the same table. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
15Duplicate specification of character classesFind regular expressions where within the same specification of a character class the character class alnum as well as 0-9, \d, A-Z, or a-z has been defined.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-24 10:43MIT License
16Duplicate triggersFind cases where the same table has multiple triggers with the same type (row-level, statement-level) that react to the same event with the same WHEN condition and with the same way (by invoking the same function).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
17Inconsistent referencing to character classesFind as to whether regular expressions use inconsistently references to character classes: [^\s], [^\d], [^\w], [^[:space:]], [^[:digit:]], [^[:word:]] vs [^\S], [^\D], [^\W].Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-09 12:02MIT License
18Inconsistent referencing to character classes (digits)Find as to whether different syntaxes (e.g., 0-9 vs [[:digit:]] or \d) are used to refer to the character class of digits within the same database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-01 11:57MIT License
19Inconsistent referencing to character classes (shorthand vs long name)Find as to whether different syntaxes (e.g., \s vs [[:space:]]) are used to refer to character classes within the same database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-01 11:57MIT License
20Inconsistent use of length and char_length functionsFind as to whether both functions length and char_length are used in the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-10 14:38MIT License