Filter Queries

Found 1077 queries.

Page 2 of 54
  • 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.

#21. Base table columns for recording geographic coordinates (based on column names)

INFORMATION_SCHEMA only

Find base table columns that are according to the name meant for recording coordinates.

General License: MIT (opens in new tab)

#22. Base table columns for recording geographic coordinates that do not have a suitable type (based on column names)

INFORMATION_SCHEMA only

Find base table columns that are according to the name meant for recording geographic coordinate but do not have a suitable type (numeric or point).

Problem detection License: MIT (opens in new tab)

#23. Base table columns for storing username, password, and salt

INFORMATION_SCHEMA only

Find base table columns that name refers to the possibility that these are used to register usernames, passwords, and salt. Password should not be open text. It should be a hash value that has been hashed by using salt.

General License: MIT (opens in new tab)

#24. Base table columns with CHAR(n) or VARCHAR(n) type

INFORMATION_SCHEMA only

Find base table columns with CHAR(n) or VARCHAR(n) type and make sure that n is not too big or too small. Also make sure that you do not use CHAR(n) in case of columns that have to keep variable length strings. "Values of type character are physically padded with spaces to the specified width n, and are stored and displayed that way" (https://www.postgresql.org/docs/current/datatype-character.html)

General License: MIT (opens in new tab)

#25. Base table columns with DECIMAL (p, s) or NUMERIC (p, s) type

INFORMATION_SCHEMA only

Find base table columns with DECIMAL (p, s) or NUMERIC (p, s) type and make sure that precision p and scale s are not too big or too small.

General License: MIT (opens in new tab)

#26. Base table columns with one of the following types: BIGINT, INTEGER, TEXT, or VARCHAR without max character length

INFORMATION_SCHEMA only

Each column should have the most appropriate data type. Developers sometimes misuse BIGINT, INTEGER, TEXT or VARCHAR type in places where a type that permits smaller values would be more appropriate and semantically descriptive.

General License: MIT (opens in new tab)

#27. Base table columns with SMALLINT or BOOLEAN type

INFORMATION_SCHEMA only

Each column should have the most appropriate data type. Developers sometimes forget to use SMALLINT type even if it is logically the best choice. Developers also sometimes forget to use BOOLEAN type and instead invent something.

General License: MIT (opens in new tab)

#28. Base table columns with the same name and type have different field sizes

INFORMATION_SCHEMA only

Find base table columns that have the same name and type but different field size.

Problem detection License: MIT (opens in new tab)

#29. Base table columns with the same name have different types

INFORMATION_SCHEMA only

This query identifies semantic inconsistencies across the database schema by finding base table columns that share the same identifier (name) but are defined with differing data types. According to standard data modeling principles, a shared attribute name implies a shared domain concept (e.g., status_code should consistently be an SMALLINT or a CHAR). Discrepancies in data types for homonymous columns (e.g., is_active being BOOLEAN in one table and SMALLINT in another) hinder interoperability, complicate join logic, and confuse developers.

Problem detection License: MIT (opens in new tab)

#30. Base table columns with the type VARCHAR(1)

INFORMATION_SCHEMA only

The choice of data types should reveal as much as possible about the nature of the data in the column. The type of these columns could be CHAR(1) and they should have a constraint that a value in the column cannot be an empty string.

Problem detection License: MIT (opens in new tab)

#31. Base table columns with UUID type

INFORMATION_SCHEMA only

Each column should have the most appropriate data type. If one does not want to have in a table the surrogate key that values are generated by using a sequence generator, then one may use instead a column with Universally Unique Identifiers as the key column.

General License: MIT (opens in new tab)

#32. Base tables and foreign tables that have no CHECK constraints

INFORMATION_SCHEMA only

What are the base tables and foreign tables without any associated (directly or through domains) check constraints? A NOT NULL constraint is a kind of CHECK constraint. However, this query does not take into account NOT NULL constraints.

Problem detection License: MIT (opens in new tab)

#33. Base tables that have only the surrogate key and do not have any other column

INFORMATION_SCHEMA only

Do not create unnecessary tables. If a table has cardinality 1 (one column), then most probably the values in this column should not be system generated unique values.

Problem detection License: MIT (opens in new tab)

#34. Base tables where all the columns are optional

INFORMATION_SCHEMA only

Find base tables where all the columns are optional, i.e., permit NULLs. In such tables can be rows with no identity value and thus indistinguishable from other rows.

Problem detection License: MIT (opens in new tab)

#35. Base tables where certainly registration time is not recorded

INFORMATION_SCHEMA only

Find base tables that do not have any column with a timestamp type. In such tables certainly registration time is not recorded. Make sure as to whether recording registration time is necessary.

General License: MIT (opens in new tab)

#36. Base tables with multiple Boolean columns

INFORMATION_SCHEMA only

Find base tables that have more than one column with Boolean type.

General License: MIT (opens in new tab)

#37. Base tables with multiple comment columns

INFORMATION_SCHEMA only

Find base tables with more than one comment columns

General License: MIT (opens in new tab)

#38. Base tables with multiple name columns

INFORMATION_SCHEMA only

Find base tables with more than one name columns. Perhaps the normalization level of the table is low.

General License: MIT (opens in new tab)

#39. Base tables with multiple temporal columns

INFORMATION_SCHEMA only

Find base tables that have more than one column with a temporal type (date or timestamp).

General License: MIT (opens in new tab)

#40. Boolean column for gender

INFORMATION_SCHEMA only

Find base table columns that have Boolean type and based on the column name are meant for recording data about gender.

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(sorted ascending, activate to sort descending) Last update(activate to sort ascending) License Actions
21 Base table columns for recording geographic coordinates (based on column names) Find base table columns that are according to the name meant for recording coordinates. General INFORMATION_SCHEMA only MIT (opens in new tab) View
22 Base table columns for recording geographic coordinates that do not have a suitable type (based on column names) Find base table columns that are according to the name meant for recording geographic coordinate but do not have a suitable type (numeric or point). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
23 Base table columns for storing username, password, and salt Find base table columns that name refers to the possibility that these are used to register usernames, passwords, and salt. Password should not be open text. It should be a hash value that has been hashed by using salt. General INFORMATION_SCHEMA only MIT (opens in new tab) View
24 Base table columns with CHAR(n) or VARCHAR(n) type Find base table columns with CHAR(n) or VARCHAR(n) type and make sure that n is not too big or too small. Also make sure that you do not use CHAR(n) in case of columns that have to keep variable length strings. "Values of type character are physically padded with spaces to the specified width n, and are stored and displayed that way" (https://www.postgresql.org/docs/current/datatype-character.html) General INFORMATION_SCHEMA only MIT (opens in new tab) View
25 Base table columns with DECIMAL (p, s) or NUMERIC (p, s) type Find base table columns with DECIMAL (p, s) or NUMERIC (p, s) type and make sure that precision p and scale s are not too big or too small. General INFORMATION_SCHEMA only MIT (opens in new tab) View
26 Base table columns with one of the following types: BIGINT, INTEGER, TEXT, or VARCHAR without max character length Each column should have the most appropriate data type. Developers sometimes misuse BIGINT, INTEGER, TEXT or VARCHAR type in places where a type that permits smaller values would be more appropriate and semantically descriptive. General INFORMATION_SCHEMA only MIT (opens in new tab) View
27 Base table columns with SMALLINT or BOOLEAN type Each column should have the most appropriate data type. Developers sometimes forget to use SMALLINT type even if it is logically the best choice. Developers also sometimes forget to use BOOLEAN type and instead invent something. General INFORMATION_SCHEMA only MIT (opens in new tab) View
28 Base table columns with the same name and type have different field sizes Find base table columns that have the same name and type but different field size. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
29 Base table columns with the same name have different types This query identifies semantic inconsistencies across the database schema by finding base table columns that share the same identifier (name) but are defined with differing data types. According to standard data modeling principles, a shared attribute name implies a shared domain concept (e.g., status_code should consistently be an SMALLINT or a CHAR). Discrepancies in data types for homonymous columns (e.g., is_active being BOOLEAN in one table and SMALLINT in another) hinder interoperability, complicate join logic, and confuse developers. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
30 Base table columns with the type VARCHAR(1) The choice of data types should reveal as much as possible about the nature of the data in the column. The type of these columns could be CHAR(1) and they should have a constraint that a value in the column cannot be an empty string. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
31 Base table columns with UUID type Each column should have the most appropriate data type. If one does not want to have in a table the surrogate key that values are generated by using a sequence generator, then one may use instead a column with Universally Unique Identifiers as the key column. General INFORMATION_SCHEMA only MIT (opens in new tab) View
32 Base tables and foreign tables that have no CHECK constraints What are the base tables and foreign tables without any associated (directly or through domains) check constraints? A NOT NULL constraint is a kind of CHECK constraint. However, this query does not take into account NOT NULL constraints. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
33 Base tables that have only the surrogate key and do not have any other column Do not create unnecessary tables. If a table has cardinality 1 (one column), then most probably the values in this column should not be system generated unique values. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
34 Base tables where all the columns are optional Find base tables where all the columns are optional, i.e., permit NULLs. In such tables can be rows with no identity value and thus indistinguishable from other rows. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
35 Base tables where certainly registration time is not recorded Find base tables that do not have any column with a timestamp type. In such tables certainly registration time is not recorded. Make sure as to whether recording registration time is necessary. General INFORMATION_SCHEMA only MIT (opens in new tab) View
36 Base tables with multiple Boolean columns Find base tables that have more than one column with Boolean type. General INFORMATION_SCHEMA only MIT (opens in new tab) View
37 Base tables with multiple comment columns Find base tables with more than one comment columns General INFORMATION_SCHEMA only MIT (opens in new tab) View
38 Base tables with multiple name columns Find base tables with more than one name columns. Perhaps the normalization level of the table is low. General INFORMATION_SCHEMA only MIT (opens in new tab) View
39 Base tables with multiple temporal columns Find base tables that have more than one column with a temporal type (date or timestamp). General INFORMATION_SCHEMA only MIT (opens in new tab) View
40 Boolean column for gender Find base table columns that have Boolean type and based on the column name are meant for recording data about gender. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View