Filter Queries

Found 1056 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 the relatively small amount of data in the system catalog of a database.

#681. Number of using views

INFORMATION_SCHEMA+system catalog base tables

Find statistics about how many base tables have how many derived tables that use these tables.

Sofware measure License: MIT (opens in new tab)

#682. Number of views with and without security barrier

INFORMATION_SCHEMA+system catalog base tables

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 License: MIT (opens in new tab)

#683. ON DELETE SET NULL is probably missing

system catalog base tables only

Find implementations of the adjacency list design pattern, where the corresponding foreign key columns are optional but the foreign key constraint does not have ON DELETE SET NULL compensating action. Implement adjacency list correctly.

Problem detection License: MIT (opens in new tab)

#684. One-to-one relationships

system catalog base tables only

Find one-to-one relationships between base tables. In this case the foreign key columns must have primary key or unique constraint. These tables could implement inheritance hierarchy that has been specified in the conceptual data model.

General License: MIT (opens in new tab)

#685. Only ID primary key

INFORMATION_SCHEMA+system catalog base tables

Find base base tables have the simple primary key that contains a column with the (case insensitive) name id and an integer type. In addition, the primary key values are generated automatically by the system by using a sequence generator. In addition the base table must not have any unique constraint.

Problem detection License: MIT (opens in new tab)

#686. Only one value permitted in a base table or a foreign table column (based on check constraints)

INFORMATION_SCHEMA+system catalog base tables

Find columns of base tables or foreign tables in case of which a check constraint on the column permits only one value in the column. The constraint may be correct if it is applied to a column of a subtable that is inherited from the supertable or is used to enfore the rule that the table can have at most one row.

General License: MIT (opens in new tab)

#687. Only one value permitted in a base table or a foreign table column (based on enumeration types)

INFORMATION_SCHEMA+system catalog base tables

Find columns of base tables or foreign tables in case of which the type of the column permits only one value in the column. The type is an enumeration type that specifies only one value.

Problem detection License: MIT (opens in new tab)

#688. Only one value permitted in a non-inherited base table or a foreign table column (based on check constraints)

INFORMATION_SCHEMA+system catalog base tables

Find columns of base tables or foreign tables in case of which a check constraint on the column permits only one value in the column. Exclude columns that are inherited from a supertable because the constraint may be correct if it is applied to a column of a subtable that is inherited from the supertable.

Problem detection License: MIT (opens in new tab)

#689. Optional base table columns

INFORMATION_SCHEMA only

Find optional base table columns, i.e., columns that permit NULLs. Are you sure you want to allow NULLs in these columns?

General License: MIT (opens in new tab)

#690. Optional base table columns that participate in a UNIQUE constraint or index

INFORMATION_SCHEMA+system catalog base tables

Find optional base table columns that participate in a UNIQUE constraint or index. Each base table has one or more candidate keys. One of these is usually selected to be the primary key, other are called alternate keys. To enforce an alternate key one should define a UNIQUE constraint and determine that all the key columns are mandatory (NOT NULL) just like the primary key columns are mandatory. Make sure that the NOT NULL constraint is not missing on these columns.

Problem detection License: MIT (opens in new tab)

#691. Optional columns before mandatory columns

INFORMATION_SCHEMA only

Find cases where optional columns are before a mandatory column. Place mandatory columns before optional columns to improve comprehensibility of the table.

Problem detection License: MIT (opens in new tab)

#692. Optional composite foreign keys that do not have MATCH FULL specified

system catalog base tables only

Find optional composite foreign keys that do not have MATCH FULL specified. Without MATCH FULL the system will permit partial foreign key values

Problem detection License: MIT (opens in new tab)

#693. Optional foreign key columns

INFORMATION_SCHEMA only

Find foreign key columns that do not have the NOT NULL constraint. It is better to limit the use of NULLs and optional columns due to the problems that it causes in interpreting the query results, making queries, and enforcing constraints. In addition, one should check as to whether this kind of design is consistent with the multiplicities in the conceptual data model.

General License: MIT (opens in new tab)

#694. Optional non-foreign key base table columns that participate in a UNIQUE constraint or index

INFORMATION_SCHEMA+system catalog base tables

Find optional base table columns that participate in a UNIQUE constraint or index but do not participate in a foreign key constraint. Each base table has one or more candidate keys. One of these is usually selected to be the primary key, other are called alternate keys. To enforce an alternate key one should define a UNIQUE constraint and determine that all the key columns are mandatory (NOT NULL) just like the primary key columns are mandatory. Make sure that the NOT NULL constraint is not missing on these columns.

Problem detection License: MIT (opens in new tab)

#695. Overlapping non-function based indexes that have the same leading column but with different operator class

system catalog base tables only

Find non-function based indexes (both unique and non-unique) that have identical first column but the operator class that is used in case of the first column is different. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration.

General License: MIT (opens in new tab)

#696. Overlapping non-function based indexes that have the same leading column with the same operator class

system catalog base tables only

Find non-function based indexes (both unique and non-unique) that duplicate each other because their first column is identical and the operator class that is used in case of the first column is identical. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration.

Problem detection License: MIT (opens in new tab)

#697. Overloading

INFORMATION_SCHEMA+system catalog base tables

Make sure that there is genuine overloading instead of duplication or dead code. "In some programming languages, function overloading or method overloading is the ability to create multiple functions of the same name with different implementations." (Wikipedia) In PostgreSQL one can do it automagically by having multiple routines with the same name but different parameters in the same schema.

General License: MIT (opens in new tab)

#698. Overloading may cause runtime error

INFORMATION_SCHEMA+system catalog base tables

Routines in the same schema that have the same name and that have parameters with different types or different number of parameters are not considered to be in conflict at the creation time. However, if defaults are provided in the definition of parameters, then these routines might be conflict during runtime.

Problem detection License: MIT (opens in new tab)

#699. Pairs of base tables that have at least two columns with the same names and data types

INFORMATION_SCHEMA only

What are the pairs of base tables that have at least two columns with the same names and data types. The tables might violate the principle of orthogonal design and hence might facilitate uncontrolled data redundancy over different tables.

Problem detection License: MIT (opens in new tab)

#700. Pairs of non-key column name and type pairs that have in different base tables a different default value

INFORMATION_SCHEMA+system catalog base tables

Find non-key base table columns with the same name and type that have different default values. Be consistent. Columns with the same name and type shouldn't probably have different default values in case of different tables. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)

Problem detection License: MIT (opens in new tab)
# Name(activate to sort ascending) Goal(activate to sort ascending) Type(activate to sort ascending) Data source(activate to sort ascending) Last update(sorted descending, activate to sort ascending) License Actions
681 Number of using views Find statistics about how many base tables have how many derived tables that use these tables. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
682 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 MIT (opens in new tab) View (opens in new tab)
683 ON DELETE SET NULL is probably missing Find implementations of the adjacency list design pattern, where the corresponding foreign key columns are optional but the foreign key constraint does not have ON DELETE SET NULL compensating action. Implement adjacency list correctly. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
684 One-to-one relationships Find one-to-one relationships between base tables. In this case the foreign key columns must have primary key or unique constraint. These tables could implement inheritance hierarchy that has been specified in the conceptual data model. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
685 Only ID primary key Find base base tables have the simple primary key that contains a column with the (case insensitive) name id and an integer type. In addition, the primary key values are generated automatically by the system by using a sequence generator. In addition the base table must not have any unique constraint. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
686 Only one value permitted in a base table or a foreign table column (based on check constraints) Find columns of base tables or foreign tables in case of which a check constraint on the column permits only one value in the column. The constraint may be correct if it is applied to a column of a subtable that is inherited from the supertable or is used to enfore the rule that the table can have at most one row. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
687 Only one value permitted in a base table or a foreign table column (based on enumeration types) Find columns of base tables or foreign tables in case of which the type of the column permits only one value in the column. The type is an enumeration type that specifies only one value. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
688 Only one value permitted in a non-inherited base table or a foreign table column (based on check constraints) Find columns of base tables or foreign tables in case of which a check constraint on the column permits only one value in the column. Exclude columns that are inherited from a supertable because the constraint may be correct if it is applied to a column of a subtable that is inherited from the supertable. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
689 Optional base table columns Find optional base table columns, i.e., columns that permit NULLs. Are you sure you want to allow NULLs in these columns? General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
690 Optional base table columns that participate in a UNIQUE constraint or index Find optional base table columns that participate in a UNIQUE constraint or index. Each base table has one or more candidate keys. One of these is usually selected to be the primary key, other are called alternate keys. To enforce an alternate key one should define a UNIQUE constraint and determine that all the key columns are mandatory (NOT NULL) just like the primary key columns are mandatory. Make sure that the NOT NULL constraint is not missing on these columns. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
691 Optional columns before mandatory columns Find cases where optional columns are before a mandatory column. Place mandatory columns before optional columns to improve comprehensibility of the table. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
692 Optional composite foreign keys that do not have MATCH FULL specified Find optional composite foreign keys that do not have MATCH FULL specified. Without MATCH FULL the system will permit partial foreign key values Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
693 Optional foreign key columns Find foreign key columns that do not have the NOT NULL constraint. It is better to limit the use of NULLs and optional columns due to the problems that it causes in interpreting the query results, making queries, and enforcing constraints. In addition, one should check as to whether this kind of design is consistent with the multiplicities in the conceptual data model. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
694 Optional non-foreign key base table columns that participate in a UNIQUE constraint or index Find optional base table columns that participate in a UNIQUE constraint or index but do not participate in a foreign key constraint. Each base table has one or more candidate keys. One of these is usually selected to be the primary key, other are called alternate keys. To enforce an alternate key one should define a UNIQUE constraint and determine that all the key columns are mandatory (NOT NULL) just like the primary key columns are mandatory. Make sure that the NOT NULL constraint is not missing on these columns. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
695 Overlapping non-function based indexes that have the same leading column but with different operator class Find non-function based indexes (both unique and non-unique) that have identical first column but the operator class that is used in case of the first column is different. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
696 Overlapping non-function based indexes that have the same leading column with the same operator class Find non-function based indexes (both unique and non-unique) that duplicate each other because their first column is identical and the operator class that is used in case of the first column is identical. Include unique indexes that support a constraint (primary key, unique, exclude), i.e., these indexes have been automatically created due to the constraint declaration. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
697 Overloading Make sure that there is genuine overloading instead of duplication or dead code. "In some programming languages, function overloading or method overloading is the ability to create multiple functions of the same name with different implementations." (Wikipedia) In PostgreSQL one can do it automagically by having multiple routines with the same name but different parameters in the same schema. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
698 Overloading may cause runtime error Routines in the same schema that have the same name and that have parameters with different types or different number of parameters are not considered to be in conflict at the creation time. However, if defaults are provided in the definition of parameters, then these routines might be conflict during runtime. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
699 Pairs of base tables that have at least two columns with the same names and data types What are the pairs of base tables that have at least two columns with the same names and data types. The tables might violate the principle of orthogonal design and hence might facilitate uncontrolled data redundancy over different tables. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
700 Pairs of non-key column name and type pairs that have in different base tables a different default value Find non-key base table columns with the same name and type that have different default values. Be consistent. Columns with the same name and type shouldn't probably have different default values in case of different tables. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code) Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)