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.

#561. A table has the same name as a routine

INFORMATION_SCHEMA+system catalog base tables

Find table names that are the same as some routine name. Use different names to avoid confusion.

Problem detection License: MIT (opens in new tab)

#562. Grantable table privileges

INFORMATION_SCHEMA+system catalog base tables

Find table privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible.

Problem detection License: MIT (opens in new tab)

#563. Table, routine, and usage privileges that have been granted to a superuser

INFORMATION_SCHEMA+system catalog base tables

Find table, routine, and usage privileges that have been granted to a superuser. Superuser can do anything in the database and thus does not need the privileges. The result is a sign that perhaps the executed GRANT statements were incorrect (wrong username) or the grantee later got superuser status (that it shouldn't have).

Problem detection License: MIT (opens in new tab)

#564. Table has both state and status columns

INFORMATION_SCHEMA+system catalog base tables

Find tables that contain both a state and a status column.

General License: MIT (opens in new tab)

#565. Table has multiple columns for free-form descriptions

INFORMATION_SCHEMA+system catalog base tables

Find tables that contain multiple columns for free-form textual descriptions. Make sure that the names of columns are understandable and sufficiently different. Make sure that there are no duplicate columns.

General License: MIT (opens in new tab)

#566. Small tables

INFORMATION_SCHEMA+system catalog base tables

Find tables that have one column or zero columns.

General License: MIT (opens in new tab)

#567. Name and description maximum length

INFORMATION_SCHEMA+system catalog base tables

Find tables where is both a column for registering name and description. Find the permitted maximum field size in these columns. Take into account that the maximum length may be controlled by using a CHECK constraint. Make sure that the permitted maximum field sizes are sufficiently different.

General License: MIT (opens in new tab)

#568. Trigger is used to enforce referential integrity

INFORMATION_SCHEMA+system catalog base tables

Find tables where user-defined (non-system) triggers are used to implement referential integrity. In addition to table name show the triggers and the number of triggers.

Problem detection License: MIT (opens in new tab)

#569. Tables with the same name in different schemas

INFORMATION_SCHEMA+system catalog base tables

Find tables with the same name in different schemas. Make sure that this is not a duplication.

General License: MIT (opens in new tab)

#570. Username is not unique

INFORMATION_SCHEMA+system catalog base tables

Find textual columns that potentially contain usernames (including columns that potentially contain e-mail addresses) that do not have a unique constraint or a unique index that involves only this column.

Problem detection License: MIT (opens in new tab)

#571. Base tables with the biggest number of rows

system catalog base tables only

Find the base tables that belong to the top 5 in terms of the number of rows in the table. There should be test data in the tables.

General License: MIT (opens in new tab)

#572. Base tables where all the unique columns are optional

INFORMATION_SCHEMA+system catalog base tables

Find the base tables where all the unique columns are optional. In such tables there can be rows without values that identify these rows. In this case there can be rows in the table where the values that should identify the row are missing.

Problem detection License: MIT (opens in new tab)

#573. Different foreign key column names in case of referencing the same candidate key

system catalog base tables only

Find the cases when the names of columns in different foreign keys that reference to the same candidate key are different. If different names reflect different roles, then it is legitimate. However, there could also be accidental differences that makes it more difficult to use the database.

Problem detection License: MIT (opens in new tab)

#574. Columns that have the same name as their domain/type

INFORMATION_SCHEMA+system catalog base tables

Find the columns that name is the same as the name of the type of the column or the domain of the column.

Problem detection License: MIT (opens in new tab)

#575. Using system-defined names of constraints (constraints that involve more than one column)

system catalog base tables only

Find the constraint types in case of which there exists system-defined names.

Problem detection License: MIT (opens in new tab)

#576. Using system-defined names of constraints (constraints that involve one column)

system catalog base tables only

Find the constraint types in case of which there exists system-defined names.

Problem detection License: MIT (opens in new tab)

#577. Derived tables that have a column with the xid type

INFORMATION_SCHEMA+system catalog base tables

Find the derived tables (views and materialized views) that have a column with the xid type, i.e., these use the data from the hidden xmin column of a base table. If one uses optimistic approach for dealing with the concurrent data modifications, then xmin values should be presented by views and used in routines that modify or delete rows.

General License: MIT (opens in new tab)

#578. Different non-surrogate key default values

INFORMATION_SCHEMA only

Find the different default values that implement something other than a surrogate key.

General License: MIT (opens in new tab)

#579. Different search paths of SECURITY DEFINER functions

INFORMATION_SCHEMA+system catalog base tables

Find the different search paths used in case of SECURITY DEFINER functions and the number of their occurrences. Make sure that these have been specified correctly and consistently and that they do not refer to any non-existent schemas.

General License: MIT (opens in new tab)

#580. The number and percentage of base tables without CHECK constraints

INFORMATION_SCHEMA only

Find the extent in which data integrity is checked at the database level. Find the number and percentage of base tables that do not have any associated CHECK constraints.

Sofware measure License: MIT (opens in new tab)
# Name Goal (sorted ascending) Type Data source Last update License Actions
561 A table has the same name as a routine Find table names that are the same as some routine name. Use different names to avoid confusion. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
562 Grantable table privileges Find table privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
563 Table, routine, and usage privileges that have been granted to a superuser Find table, routine, and usage privileges that have been granted to a superuser. Superuser can do anything in the database and thus does not need the privileges. The result is a sign that perhaps the executed GRANT statements were incorrect (wrong username) or the grantee later got superuser status (that it shouldn't have). Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
564 Table has both state and status columns Find tables that contain both a state and a status column. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
565 Table has multiple columns for free-form descriptions Find tables that contain multiple columns for free-form textual descriptions. Make sure that the names of columns are understandable and sufficiently different. Make sure that there are no duplicate columns. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
566 Small tables Find tables that have one column or zero columns. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
567 Name and description maximum length Find tables where is both a column for registering name and description. Find the permitted maximum field size in these columns. Take into account that the maximum length may be controlled by using a CHECK constraint. Make sure that the permitted maximum field sizes are sufficiently different. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
568 Trigger is used to enforce referential integrity Find tables where user-defined (non-system) triggers are used to implement referential integrity. In addition to table name show the triggers and the number of triggers. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
569 Tables with the same name in different schemas Find tables with the same name in different schemas. Make sure that this is not a duplication. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
570 Username is not unique Find textual columns that potentially contain usernames (including columns that potentially contain e-mail addresses) that do not have a unique constraint or a unique index that involves only this column. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
571 Base tables with the biggest number of rows Find the base tables that belong to the top 5 in terms of the number of rows in the table. There should be test data in the tables. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
572 Base tables where all the unique columns are optional Find the base tables where all the unique columns are optional. In such tables there can be rows without values that identify these rows. In this case there can be rows in the table where the values that should identify the row are missing. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
573 Different foreign key column names in case of referencing the same candidate key Find the cases when the names of columns in different foreign keys that reference to the same candidate key are different. If different names reflect different roles, then it is legitimate. However, there could also be accidental differences that makes it more difficult to use the database. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
574 Columns that have the same name as their domain/type Find the columns that name is the same as the name of the type of the column or the domain of the column. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
575 Using system-defined names of constraints (constraints that involve more than one column) Find the constraint types in case of which there exists system-defined names. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
576 Using system-defined names of constraints (constraints that involve one column) Find the constraint types in case of which there exists system-defined names. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
577 Derived tables that have a column with the xid type Find the derived tables (views and materialized views) that have a column with the xid type, i.e., these use the data from the hidden xmin column of a base table. If one uses optimistic approach for dealing with the concurrent data modifications, then xmin values should be presented by views and used in routines that modify or delete rows. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
578 Different non-surrogate key default values Find the different default values that implement something other than a surrogate key. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
579 Different search paths of SECURITY DEFINER functions Find the different search paths used in case of SECURITY DEFINER functions and the number of their occurrences. Make sure that these have been specified correctly and consistently and that they do not refer to any non-existent schemas. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
580 The number and percentage of base tables without CHECK constraints Find the extent in which data integrity is checked at the database level. Find the number and percentage of base tables that do not have any associated CHECK constraints. Sofware measure INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)