| 681 |
The number of user defined triggers by different characteristics |
Find the number of user defined triggers by action orientation (ROW, STATEMENT), action timing (BEFORE, AFTER, INSTEAD OF), and event type (INSERT, UPDATE, DELETE) and their combinations. |
Sofware measure |
INFORMATION_SCHEMA only |
2025-11-07 10:11 |
MIT License |
View |
| 682 |
The use of xmin hidden column in views and routines |
Find the number of views and materialized views that have a column with the xid type and the number of routines that contain a UPDATE or a DELETE statement that search condition refers to the xmin column. If one uses optimistic approach for dealing with the concurrent modifications of data, then xmin values should be presented by views and used in routines that modify or delete rows. |
Sofware measure |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 683 |
Number of views with and without security barrier |
Find the number of views, the number of views with and without security barrier setting, and the names of views with and without the security barrier setting. |
Sofware measure |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 684 |
Patterns of the names of columns of simple primary keys |
Find the patterns of the names of columns of simple primary keys. Make sure that the naming is consistent. Ideally, the names should indicate as to whether the column is a surrogate or a natural key column. PostgreSQL 14 added primary keys, unique constraints, and foreign keys to system catalogs. Thus the query was modified to exclude the results from the system catalog. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 685 |
Patterns of the names of triggers and rules |
Find the patterns of the names of trigger and rule names. Make sure that the naming is consistent. |
General |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 686 |
All database privileges |
Find the privileges to use the database. c - CONNECT; C - CREATE; T - TEMPORARY. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 687 |
The size of base tables and their indexes |
Find the size of base tables without indexes, size of the indexes of the table, total size of the table (including its indexes) and percentage of the index size from the total size. If the size of indexes of a table is relatively high, then check as to whether all the indexes are needed. |
General |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 688 |
The generic names (columns) (aggregate view) |
Find the too generic column names and the number of their occurrences. |
Problem detection |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 689 |
The longest names of database objects |
Find the TOP 3 longest (identifiers) names of user-defined objects. |
General |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 690 |
The number of columns based on table type |
Find the total number of columns in the different types of tables as well as average number of columns in the tables as well as minimal and maximal number of columns. |
Sofware measure |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 691 |
The number of default values |
Find the total number of columns with a default value as well as the number of columns with different kinds of default values (the number of columns where the default is used to implement surrogate key, the number of columns where the default is not used to implement surrogate key, the number of columns with a static default value, the number of columns with a dynamic default value). |
Sofware measure |
INFORMATION_SCHEMA only |
2025-11-07 10:11 |
MIT License |
View |
| 692 |
Incorrect check of NULLs |
Find the use of =NULL and <>NULL in case of table level check constraints, domain level check constraints, WHEN clauses of triggers, WHERE clauses of rules, subqueries of derived tables, and bodies of routines. Write correct code. In order to determine as to whether a value is missing or not one has to use the IS [NOT] NULL predicate. NULL is the marker in SQL that denotes a missing value. Although it is often called "NULL value", one cannot treat it as an ordinary value, i.e., use it in comparisons as a value. |
Problem detection |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 693 |
Incorrect specification of logical or in regular expressions |
Find the use of regular expressions where logical or is incorrectly specified, i.e., (| or |). |
Problem detection |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 694 |
The same trigger function is used in case of multiple tables |
Find trigger functions that are used in case of more than one table. Although it is legal, one must be careful when changing the functions in order to avoid unwanted consequences. |
General |
INFORMATION_SCHEMA only |
2025-11-07 10:11 |
MIT License |
View |
| 695 |
Trigger functions with a conditional statement |
Find trigger functions that contain a conditional (IF or CASE) but do not contain a SELECT statement before these. The latter condition is for the reason that one cannot use a subquery in the WHEN clause. Thus, if one wants to make a query and decide the further action based on the results of the query, then one must do it within the body of the function. |
Problem detection |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 696 |
Triggers with the same name in different schemas |
Find trigger names that are used in a database in more than one schema. Different things should have different names. But here different triggers have the same name. Also make sure that this is not a duplication. |
General |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 697 |
Triggers that are used to calculate tsvector values react to a wrong set of events |
Find triggers on base tables that are used to calculate tsvector values that react to a wrong set of events, i.e., react to the DELETE event or do not react to the INSERT and UPDATE events. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |
| 698 |
Triggers with arguments from the CREATE TRIGGER statement |
Find triggers that get an argument from the CREATE TRIGGER statement. |
General |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 699 |
Update prevention may prevent legal updates |
Find triggers that try prevent updating data in a certain column but prevent also certain legal updates - updates that write to a field a value that was in the field before the update. |
Problem detection |
INFORMATION_SCHEMA+system catalog base tables |
2025-11-07 10:11 |
MIT License |
View |
| 700 |
Too generic names (unique indexes) |
Find unique indexes that have too generic names like "key" or the name contain too generic words like "data" (all constraints restrict data in the table), or the name is an abbreviation of a constraint type name. |
Problem detection |
system catalog base tables only |
2025-11-07 10:11 |
MIT License |
View |