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.

#881. 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)

#882. Table inheritance

system catalog base tables only

Find inheritance between base tables. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables.

General License: MIT (opens in new tab)

#883. Table inheritance (path view)

system catalog base tables only

Find in case of each base table that participates in a table inheritance hierarchy the path to the table from the top-level table. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. Also make sure that the identifier of each child table in an inheritance hierarchy is a hyponym of the identifier of its parent table.

General License: MIT (opens in new tab)

#884. Table privileges

INFORMATION_SCHEMA only

Check as to whether there are no unnecessary privileges.

General License: MIT (opens in new tab)

#885. Table privileges have been granted to PUBLIC

INFORMATION_SCHEMA only

You should follow the principle of least privilege and thus not have in your database tables that usage privileges are granted to the pseudo-role PUBLIC, i.e., to all the database users now and in the future.

Problem detection License: MIT (opens in new tab)

#886. 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)

#887. Tables that have associated user triggers

system catalog base tables only

Find information about tables that are associated with triggers.

General License: MIT (opens in new tab)

#888. Tables without columns

INFORMATION_SCHEMA+system catalog base tables

Do not have in a database elements that are not useful. PostgreSQL permits tables with no columns. Such tables can be used to implement Boolean variables (tables TABLE_DEE and TABLE_DUM). On the other hand, such tables might be a result of database evolution, where developers have not noticed that they have dropped all the columns of a table or have not noticed that they have created such a table in the first place.

Problem detection License: MIT (opens in new tab)

#889. 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)

#890. Temporal function in a simple check constraint is inconsistent with the column type

system catalog base tables only

Find base table columns with a check constraint that refers to a temporal function (current_timestamp, localtimestamp, current_date, or now) that return type is inconsistent with the data type of the column.

Problem detection License: MIT (opens in new tab)

#891. Textual columns that have a secondary index but the operator class for the column does not support pattern matching

INFORMATION_SCHEMA+system catalog base tables

Find indexed textual columns where the indexing does not consider the possibility of pattern-based search. Such columns do not have an index where the used operator class makes the index suitable for use by queries involving pattern matching expressions.

Problem detection License: MIT (opens in new tab)

#892. TG_ARGV is missing

INFORMATION_SCHEMA+system catalog base tables

Write correct code. If you pass arguments to a trigger function, then the function should use the arguments. TG_ARGV[]: "Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indexes (less than 0 or greater than or equal to tg_nargs) result in a null value." (PostgreSQL documentation)

Problem detection License: MIT (opens in new tab)

#893. The expression of a check constraint that is associated with a domain needs type conversion

system catalog base tables only

Find check constraints of domains where the Boolean expression invokes an operation that does not match with the data type of the domain.

Problem detection License: MIT (opens in new tab)

#894. The generator of surrogate key values can output the same value more than once

INFORMATION_SCHEMA+system catalog base tables

Find surrogate keys where the generator can output the same value more than once. Key values must be unique, i.e., at some point the generator will prevent adding new rows to the table.

Problem detection License: MIT (opens in new tab)

#895. The longest names of database objects

INFORMATION_SCHEMA+system catalog base tables

Find the TOP 3 longest (identifiers) names of user-defined objects.

General License: MIT (opens in new tab)

#896. The longest names of database objects by object type

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) Names should be expressive. Find the TOP 3 longest (identifiers) names of user-defined objects by their type. These could be the first candidates of renaming in order to give to database objects better names.

Sofware measure License: MIT (opens in new tab)

#897. The longest referential paths

system catalog base tables only

Find the longest referential paths between the tables regardless of the schema that contain the tables.

Sofware measure License: MIT (opens in new tab)

#898. The maximum number of characters may be missing

INFORMATION_SCHEMA only

Perhaps the character maximum length has been omitted accidentally, i.e., one wrote VARCHAR instead of VARCHAR(n) where n is the maximum permitted number of characters in the field value. VARCHAR and TEXT are synonyms.

Problem detection License: MIT (opens in new tab)

#899. The name of the routine does not match with the action of the routine

INFORMATION_SCHEMA+system catalog base tables

Find user-defined non-trigger SQL and PL/pgSQL routines where the beginning of the name of the routine indicates a certain action inside the routine (INSERT, UPDATE, or DELETE) but there is no such statement in the routine body.

Problem detection License: MIT (opens in new tab)

#900. The number and percentage of base tables where all the non-primary key columns are optional

INFORMATION_SCHEMA only

Find the number and percentage of base tables where all the non-primary key columns are optional

Sofware measure License: MIT (opens in new tab)
# Name Goal Type Data source Last update (sorted descending) License Actions
881 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)
882 Table inheritance Find inheritance between base tables. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
883 Table inheritance (path view) Find in case of each base table that participates in a table inheritance hierarchy the path to the table from the top-level table. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. Also make sure that the identifier of each child table in an inheritance hierarchy is a hyponym of the identifier of its parent table. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
884 Table privileges Check as to whether there are no unnecessary privileges. General INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
885 Table privileges have been granted to PUBLIC You should follow the principle of least privilege and thus not have in your database tables that usage privileges are granted to the pseudo-role PUBLIC, i.e., to all the database users now and in the future. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
886 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)
887 Tables that have associated user triggers Find information about tables that are associated with triggers. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
888 Tables without columns Do not have in a database elements that are not useful. PostgreSQL permits tables with no columns. Such tables can be used to implement Boolean variables (tables TABLE_DEE and TABLE_DUM). On the other hand, such tables might be a result of database evolution, where developers have not noticed that they have dropped all the columns of a table or have not noticed that they have created such a table in the first place. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
889 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)
890 Temporal function in a simple check constraint is inconsistent with the column type Find base table columns with a check constraint that refers to a temporal function (current_timestamp, localtimestamp, current_date, or now) that return type is inconsistent with the data type of the column. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
891 Textual columns that have a secondary index but the operator class for the column does not support pattern matching Find indexed textual columns where the indexing does not consider the possibility of pattern-based search. Such columns do not have an index where the used operator class makes the index suitable for use by queries involving pattern matching expressions. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
892 TG_ARGV is missing Write correct code. If you pass arguments to a trigger function, then the function should use the arguments. TG_ARGV[]: "Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indexes (less than 0 or greater than or equal to tg_nargs) result in a null value." (PostgreSQL documentation) Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
893 The expression of a check constraint that is associated with a domain needs type conversion Find check constraints of domains where the Boolean expression invokes an operation that does not match with the data type of the domain. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
894 The generator of surrogate key values can output the same value more than once Find surrogate keys where the generator can output the same value more than once. Key values must be unique, i.e., at some point the generator will prevent adding new rows to the table. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
895 The longest names of database objects Find the TOP 3 longest (identifiers) names of user-defined objects. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
896 The longest names of database objects by object type "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) Names should be expressive. Find the TOP 3 longest (identifiers) names of user-defined objects by their type. These could be the first candidates of renaming in order to give to database objects better names. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
897 The longest referential paths Find the longest referential paths between the tables regardless of the schema that contain the tables. Sofware measure system catalog base tables only MIT (opens in new tab) View (opens in new tab)
898 The maximum number of characters may be missing Perhaps the character maximum length has been omitted accidentally, i.e., one wrote VARCHAR instead of VARCHAR(n) where n is the maximum permitted number of characters in the field value. VARCHAR and TEXT are synonyms. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
899 The name of the routine does not match with the action of the routine Find user-defined non-trigger SQL and PL/pgSQL routines where the beginning of the name of the routine indicates a certain action inside the routine (INSERT, UPDATE, or DELETE) but there is no such statement in the routine body. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
900 The number and percentage of base tables where all the non-primary key columns are optional Find the number and percentage of base tables where all the non-primary key columns are optional Sofware measure INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)