Filter Queries

Found 1053 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.

#541. Granted roles

system catalog base tables only

Find membership relations between roles.

General License: MIT (opens in new tab)

#542. Grantees

INFORMATION_SCHEMA only

Database must be used by users who have minimal set of privileges for performing tasks. The query helps to find out as to whether some user/role other than PUBLIC and a superuser have rights to use tables and routines of the database.

General License: MIT (opens in new tab)

#543. Identical indexes

system catalog base tables only

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

#544. Identifiers that explicitly say that they carry no meaning

INFORMATION_SCHEMA+system catalog base tables

Find identifiers that explicitly say that they carry no meaning. Such identifier is called "unnamed" or "anonymous".

Problem detection License: MIT (opens in new tab)

#545. Inappropriate field size or data type for column that strores database username

INFORMATION_SCHEMA only

Find columns of base tables that based on the default value of the column contain database username. However, the type of the column is not VARCHAR(63) or VARCHAR(128).

Problem detection License: MIT (opens in new tab)

#546. Inconsistency between the name and the type of a base table column (dates)

INFORMATION_SCHEMA only

Find base table columns that name refers to the possibility that these are used to register dates. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column data type is "date", then the suffix of the column name should be "kp" (Estonian) or "date" (English).

Problem detection License: MIT (opens in new tab)

#547. Inconsistency between the name and the type of a base table column (timestamps)

INFORMATION_SCHEMA only

Find base table columns that name refers to the possibility that these are used to register timestamps. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column type is "timestamp", then the suffix of the column name should be "aeg" (Estonian) or "time" (English).

Problem detection License: MIT (opens in new tab)

#548. Inconsistency between the type and the default value of a column (date and timestamp values)

INFORMATION_SCHEMA only

Find table columns with timestamp/date types that data type and dynamically found default value have a different type.

Problem detection License: MIT (opens in new tab)

#549. Inconsistency between the type and the default value of a column (time values)

INFORMATION_SCHEMA only

Find table columns with time types, which data type and dynamically found default value have a different type.

Problem detection License: MIT (opens in new tab)

#550. Inconsistency (code vs. id) of naming foreign key and referenced candidate key columns

system catalog base tables only

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

#551. Inconsistency of using column data types/field sizes in case of columns that implement relationships

INFORMATION_SCHEMA+system catalog base tables

Find foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.

Problem detection License: MIT (opens in new tab)

#552. Inconsistency of using parameter data types

INFORMATION_SCHEMA+system catalog base tables

Find parameters of routines that have the same name but a different type. Parameters that have the same name should have, in general, the same data type as well, assuming that the routines, which have the parameters, have different names, i.e., there is no overloading in play.

Problem detection License: MIT (opens in new tab)

#553. Inconsistent chain of relationships in terms of using ON UPDATE compensating action

system catalog base tables only

In case of a chain of relationships between tables (where the primary key and the foreign key have the same columns) the use of ON UPDATE compensating action should be consistent. For instance, in the next example there is inconsistency, because if one changes the person_code in table Person, then the modification does not succeed because it does not cascade to the table Product. It is unclear as to whether it should be possible to change the person_code or not. Person (person_code, surname) Primary key (person_code) Worker(person_code)
Primary key (person_code)
Foreign key (person_code) References Person (person_code) ON UPDATE CASCADE

Product(product_code, registrator)
Primary key (product_code)
Foreign key (registrator) References Worker (person_code) ON UPDATE NO ACTION

Problem detection License: MIT (opens in new tab)

#554. Inconsistent data type usage in case of registering a date

INFORMATION_SCHEMA only

Find as to whether there are multiple different types used in case of columns that are meant for registering dates.

Problem detection License: MIT (opens in new tab)

#555. Inconsistent data type usage in case of registering a symbol

INFORMATION_SCHEMA only

Find whether the database uses both CHAR(1) and VARCHAR(1) columns to register a single symbol.

Problem detection License: MIT (opens in new tab)

#556. Inconsistent data type usage in case of registering sums of money

INFORMATION_SCHEMA only

Find as to whether both the numeric type and integer types are used in case of columns that are meant for register data about prices.

Problem detection License: MIT (opens in new tab)

#557. Inconsistent means to calculate tsvector values

INFORMATION_SCHEMA only

Find as to whether in the database there are multiple ways to calculate tsvector values, i.e., by using a generated column and by not using a generated column.

Problem detection License: MIT (opens in new tab)

#558. Inconsistent names of database objects that are used to manage the state of main objects in the database

INFORMATION_SCHEMA+system catalog base tables

"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) The naming must be consistent. One should avoid mixing synonyms like "seisund", "staatus", and "olek" in Estonian or "state" and "status" in English and stick with one term. For instance, it is a bad practice to use word "state" in table names but word "status" in function names.

Problem detection License: MIT (opens in new tab)

#559. Inconsistent naming of comment columns

INFORMATION_SCHEMA+system catalog base tables

Find columns of tables that start with the word comment or komment but end differently (excluding numbers). Return result only if there is more than one naming variant of such columns in the database. For instance, a column has the name "comment" but another "comments".

Problem detection License: MIT (opens in new tab)

#560. Inconsistent precision and scale usage in case of registering sums of money

INFORMATION_SCHEMA only

Find as to whether different precisions/scales are used in case of registering data about sums of money in different columns.

Problem detection License: MIT (opens in new tab)
# Name Goal Type Data source Last update (sorted descending) License Actions
541 Granted roles Find membership relations between roles. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
542 Grantees Database must be used by users who have minimal set of privileges for performing tasks. The query helps to find out as to whether some user/role other than PUBLIC and a superuser have rights to use tables and routines of the database. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
543 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 MIT (opens in new tab) View (opens in new tab)
544 Identifiers that explicitly say that they carry no meaning Find identifiers that explicitly say that they carry no meaning. Such identifier is called "unnamed" or "anonymous". Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
545 Inappropriate field size or data type for column that strores database username Find columns of base tables that based on the default value of the column contain database username. However, the type of the column is not VARCHAR(63) or VARCHAR(128). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
546 Inconsistency between the name and the type of a base table column (dates) Find base table columns that name refers to the possibility that these are used to register dates. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column data type is "date", then the suffix of the column name should be "kp" (Estonian) or "date" (English). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
547 Inconsistency between the name and the type of a base table column (timestamps) Find base table columns that name refers to the possibility that these are used to register timestamps. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column type is "timestamp", then the suffix of the column name should be "aeg" (Estonian) or "time" (English). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
548 Inconsistency between the type and the default value of a column (date and timestamp values) Find table columns with timestamp/date types that data type and dynamically found default value have a different type. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
549 Inconsistency between the type and the default value of a column (time values) Find table columns with time types, which data type and dynamically found default value have a different type. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
550 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 MIT (opens in new tab) View (opens in new tab)
551 Inconsistency of using column data types/field sizes in case of columns that implement relationships Find foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
552 Inconsistency of using parameter data types Find parameters of routines that have the same name but a different type. Parameters that have the same name should have, in general, the same data type as well, assuming that the routines, which have the parameters, have different names, i.e., there is no overloading in play. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
553 Inconsistent chain of relationships in terms of using ON UPDATE compensating action In case of a chain of relationships between tables (where the primary key and the foreign key have the same columns) the use of ON UPDATE compensating action should be consistent. For instance, in the next example there is inconsistency, because if one changes the person_code in table Person, then the modification does not succeed because it does not cascade to the table Product. It is unclear as to whether it should be possible to change the person_code or not. Person (person_code, surname) Primary key (person_code) Worker(person_code)
Primary key (person_code)
Foreign key (person_code) References Person (person_code) ON UPDATE CASCADE

Product(product_code, registrator)
Primary key (product_code)
Foreign key (registrator) References Worker (person_code) ON UPDATE NO ACTION
Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
554 Inconsistent data type usage in case of registering a date Find as to whether there are multiple different types used in case of columns that are meant for registering dates. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
555 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 MIT (opens in new tab) View (opens in new tab)
556 Inconsistent data type usage in case of registering sums of money Find as to whether both the numeric type and integer types are used in case of columns that are meant for register data about prices. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
557 Inconsistent means to calculate tsvector values Find as to whether in the database there are multiple ways to calculate tsvector values, i.e., by using a generated column and by not using a generated column. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
558 Inconsistent names of database objects that are used to manage the state of main objects in the database "Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) The naming must be consistent. One should avoid mixing synonyms like "seisund", "staatus", and "olek" in Estonian or "state" and "status" in English and stick with one term. For instance, it is a bad practice to use word "state" in table names but word "status" in function names. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
559 Inconsistent naming of comment columns Find columns of tables that start with the word comment or komment but end differently (excluding numbers). Return result only if there is more than one naming variant of such columns in the database. For instance, a column has the name "comment" but another "comments". Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
560 Inconsistent precision and scale usage in case of registering sums of money Find as to whether different precisions/scales are used in case of registering data about sums of money in different columns. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)