Filter Queries

Found 997 queries.

  • All the queries about database objects contain a subcondition to exclude from the result information about the system catalog.
  • Although the statements use SQL constructs (common table expressions; NOT in subqueries) that could cause performance problems in case of large datasets it shouldn't be a problem in case of relatively small amount of data, which is in the system catalog of a database.
  • Statistics about the catalog content and project home in GitHub that has additional information.

# Name Goal Type Data source Last update License
721 Duplicate rules Find 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 detection system catalog base tables only 2021-02-25 17:30 MIT License View
722 Duplicate stored generated base table columns Find base tables that have more than one stored generated column with the same expression. The support of generated columns was added to PostgreSQL 12. 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 detection INFORMATION_SCHEMA only 2021-02-25 17:30 MIT License View
723 Duplicate triggers Find 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 detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
724 Duplicate views Find views with exactly the same subquery. There should not be multiple views with exactly the same subquery. 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 detection INFORMATION_SCHEMA only 2021-02-25 17:30 MIT License View
725 Duplication of simple CHECK constraints on the same column Find duplication of simple CHECK constraints on the same base table or foreign table column. Duplication of the same constraint means that if one starts to manage the code, then changes have to be made in multiple places. The problem is essentially similar with the data redundancy problem that database normalization tries to reduce. 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 detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
726 Enumerated or range types with the same name in different schemas Find cases where in different schemas there are enumerated or range types with the same name. Types are like words that can be used to construct generalized claims about the real world (table predicates). Better not to duplicate the words in the dictionary. Also make sure that this is not a duplication. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
727 Enumerated types with zero or one value Fidn enumerated types with zero or one value. Type is a named finite set of values. The empty set is a set. A set with one value is a set. Thus, types with zero or one value are legal. In practical terms each type, usually, should contain at least two values. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
728 Exclude constraint instead of simple UNIQUE Find exclude constraints that implement a simple UNIQUE constraint. The checking might be slower compared to UNIQUE constraint. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
729 Extension routines that execution privilege has been granted to PUBLIC Know the privileges that users have in your system. Probably all the database users do not need these privileges. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
730 Foreign key column has a default value that is not present in the parent table Find foreign key columns that have a default value that is not present in the parent table. Identify default values that cause violations of the referential constraints. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
731 Foreign key columns that have no index Find foreign key columns that do not have an index. Foreign key columns are often used for performing join operations. It is useful to index such columns. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
732 Foreign key constraint references to the columns of a UNIQUE constraint not to the columns of the PRIMARY KEY constraint Find foreign key constraints that reference to a UNIQUE constraint columns not to the PRIMARY KEY constraint columns. This is legal in SQL. However, a tradition is to refer to the primary key columns. If most of the foreign keys refer to the primary key columns, then it raises a question as to whether this kind of design decision has a good reason in a particular case or whether it is an inconsistency. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
733 Foreign key constraint references to the columns of a UNIQUE constraint not to the columns of the PRIMARY KEY constraint while the referenced table has the primary key Find foreign key constraints that reference to a UNIQUE constraint columns not to the PRIMARY KEY constraint columns while at the same time the referenced table does have the primary key. This is legal in SQL. However, a tradition is to refer to the primary key columns. If most of the foreign keys refer to the primary key columns, then it raises a question as to whether this kind of design decision has a good reason in a particular case or whether it is an inconsistency. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
734 Foreign key refers to a table that has at least one subtable in the inheritance hierarchy Find foreign key constraints that refer to a base table that has at least one subtable in the inheritance hierarchy. Rows of the subtable do not belong to the supertable in terms of checking the referential integrity. Let us assume that there is a table T with a subtable Tsub. Let us also assume that table B has a foreign key that refers to the table T. If a row is inserted into Tsub, then this row cannot be referenced from B. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
735 Function Upper or Lower is used in an index on a non-textual column Find function-based indexes that are based on function Upper or Lower but have been defined on a non-textual column. Such indexes support case insensitive search but in case of non-textual columns this does not have a meaning. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
736 Generated stored base table columns duplicates another column in the table Find generated stored columns in PostgreSQL base tables that duplicate other columns in the table. Problem detection INFORMATION_SCHEMA only 2021-02-25 17:30 MIT License View
737 Gratuitous context in the names of parameters Find routine parameter names that contain the routine name. Names of routine parameters shouldn't contain the name of the routine. It makes the names too long. A routine cannot have two parameters with the same name. Problem detection INFORMATION_SCHEMA+system catalog base tables 2021-02-25 17:30 MIT License View
738 Identical indexes Find indexes that are identical, i.e., have the same properties, including uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes. Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
739 Inconsistency (code vs. id) of naming foreign key and referenced candidate key columns Naming of foreign key and referenced candidate key columns should be consistent. It cannot be so that in one table a value is labeled "id" like some surrogate key value and in another it "turns" into human-usable "code" or vice versa. An example:

Person(person_id, name)
Primary Key (person_id)

E_mail_address(e_mail_address_id, person_code, address)
Primary Key (e_mail_address_id)
Foreign key (person_code) References Person (person_id)
Problem detection system catalog base tables only 2021-02-25 17:30 MIT License View
740 Inconsistent data type usage in case of registering a symbol Find whether the database uses both CHAR(1) and VARCHAR(1) columns to register a single symbol. Problem detection INFORMATION_SCHEMA only 2021-02-25 17:30 MIT License View