Filter Queries

Found 1096 queries.

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

#121. Candidate key columns that have a static default value

INFORMATION_SCHEMA+system catalog base tables

Find base table columns that are covered by a primary key or a unique constraint and that probably have a static default value.

Problem detection License: MIT (opens in new tab)

#122. Candidate keys and foreign keys of tables that participate in an inheritance hierarchies

system catalog base tables only

Find primary key, unique, foreign key, and exclude constraints that have been defined in tables that participate in an inheritance hierarchy. Do not forget to redefine the constraints that are defined on supertables also on their subtables.

General License: MIT (opens in new tab)

#123. Candidate keys where all columns have a static default value

INFORMATION_SCHEMA+system catalog base tables

Find base table primary key and unique constraints where all columns probably have a static default value. Candidate key columns (columns that belong to the primary key or to an unique constraints) shouldn't have static default values unless you are enforcing a rule that a table can have at most one row. The point of default values is that system assigns them automatically. There cannot be multiple rows with the same key value.

Problem detection License: MIT (opens in new tab)

#124. Cannot accommodate all the fractional seconds in case of table columns

INFORMATION_SCHEMA only

The precision of a timestamp type of a column must be able to accommodate all the fractional seconds of the default value of the column. Find table columns with the type timestamp without time zone(m) or timestamp with time zone(m) that have a default value LOCALTIMESTAMP(n) or CURRENT_TIMESTAMP(n) WHERE n>m.

Problem detection License: MIT (opens in new tab)

#125. Cannot register all legal e-mail addresses

INFORMATION_SCHEMA+system catalog base tables

Find CHECK constraints on base table or foreign table columns that contain data about e-mail addresses and apply unnecessary restrictions to the these, rejecting potentially some legal addresses. More precisely, find CHECK constraints that prevent registration of e-mail addresses with multiple @ signs.

Problem detection License: MIT (opens in new tab)

#126. Cascading update is not needed (based on surrogate keys)

INFORMATION_SCHEMA+system catalog base tables

Find foreign key constraints that reference to a candidate key that is a surrogate key, i.e., its values are generated by the system by using sequence generators. Do not use ON UPDATE CASCADE, ON UPDATE SET NULL, and ON UPDATE SET DEFAULT in case of foreign keys that reference to surrogate keys.

Problem detection License: MIT (opens in new tab)

#127. Case-insensitive regular expressions (~* or !~*) containing both uppercase and lowercase letters

INFORMATION_SCHEMA+system catalog base tables

This query identifies database objects (table and domain CHECK constraints, trigger WHEN conditions, rules, views, materialized views, and user-defined routines) that use a case-insensitive regular expression operator (~* or !~*), yet contain both uppercase and lowercase letters inside the regular expression pattern (for example, col ~* '^[A-Z][a-z]+$', col ~* '^[ab].*[C-D]', or col ~* '^[a-zA-Z0-9]+$').

Combining a case-insensitive operator with a mixed-case regular expression pattern indicates one of two issues:


  • Incorrect operator (broken case validation): The developer intended to enforce distinct case rules for different parts of the string (such as requiring an uppercase letter in one position and a lowercase letter in another, e.g., '^[C].*[a-z]' or '^\$2[abxy]\$[0-9]{2}\$[./A-Za-z0-9]{53}$'), but mistakenly used ~* (or !~*) instead of the case-sensitive operator ~ (or !~). Because ~* disables case sensitivity across the entire pattern, the intended case restrictions are silently bypassed.

  • Redundant or inconsistent pattern style: The developer genuinely intended case-insensitive matching, but redundantly specified both letter cases (such as a-zA-Z) or mixed uppercase and lowercase characters inconsistently within the pattern.

Problem detection License: MIT (opens in new tab)

#128. Case insensitive search

INFORMATION_SCHEMA+system catalog base tables

Refers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. Find user-defined routines and derived tables (views/materialized views) that have a subquery with case insensitive search (by using the upper or lower function or ILIKE predicate or (?i) modifier of a regular expression pattern).

General License: MIT (opens in new tab)

#129. Case sensitive and case insensitive uniqueness of the same simple key

INFORMATION_SCHEMA+system catalog base tables

Find sets of columns that have both case sensitive and case insesitive unique constraints enforced based on these columns. In case of textual columns uniqueness could be checked either in case sensitive or case insensitive way. It is a contradiction to check the uniqueneness in both ways in case of the same key.

Problem detection License: MIT (opens in new tab)

#130. Chains of ON DELETE CASCADE

system catalog base tables only

This query identifies referential paths (chains of foreign key relationships) where every constraint in the path is configured with ON DELETE CASCADE. The analysis is intended to uncover potential transitive deletion risks, where a single DELETE operation on a root table could trigger a catastrophic, cascading data loss across multiple, deeply-nested tables. The length of such chains is a key indicator of architectural fragility.

General License: MIT (opens in new tab)

#131. CHAR columns have a default value that length is shorter from the character maximum length of the column

INFORMATION_SCHEMA only

Choose a suitable data type, field size, and default value. If the default value is shorter from the character maximum length, then spaces will be added to the end of the registered value.

Problem detection License: MIT (opens in new tab)

#132. CHAR or VARCHAR columns have a default value that length is longer from the character maximum length of the column

INFORMATION_SCHEMA only

Find table columns with CHAR or VARCHAR type that have a default value that length is longer from the character maximum length of the column. Choose a suitable data type, field size, and default value. If the value is longer, then it is impossible to register it in a field, i.e., it makes registration of data impossible (except if the excessive characters are spaces).

Problem detection License: MIT (opens in new tab)

#133. Check as to wheteher the names of columns are in the plural or in the singular form (English version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)

#134. Check as to wheteher the names of columns are in the plural or in the singular form (English version) (aggregate view)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of columns that name is in plural or in singular by table type.

Sofware measure License: MIT (opens in new tab)

#135. Check as to wheteher the names of columns are in the plural or in the singular form (Estonian version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)

#136. Check as to wheteher the names of parameters are in the plural or in the singular form (English version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of routine parameters are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)

#137. Check as to wheteher the names of parameters are in the plural or in the singular form (Estonian version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of routine parameters are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)

#138. Check as to wheteher the names of tables are in the plural or in the singular form (English version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)

#139. Check as to wheteher the names of tables are in the plural or in the singular form (English version) (aggregate view)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of tables that name is in plural or in singular by table type.

Sofware measure License: MIT (opens in new tab)

#140. Check as to wheteher the names of tables are in the plural or in the singular form (Estonian version)

INFORMATION_SCHEMA+system catalog base tables

Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming.

General License: MIT (opens in new tab)
# Name(sorted ascending, activate to sort descending) Goal(activate to sort ascending) Type(activate to sort ascending) Data source(activate to sort ascending) Last update(activate to sort ascending) License Actions
121 Candidate key columns that have a static default value Find base table columns that are covered by a primary key or a unique constraint and that probably have a static default value. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
122 Candidate keys and foreign keys of tables that participate in an inheritance hierarchies Find primary key, unique, foreign key, and exclude constraints that have been defined in tables that participate in an inheritance hierarchy. Do not forget to redefine the constraints that are defined on supertables also on their subtables. General system catalog base tables only MIT (opens in new tab) View
123 Candidate keys where all columns have a static default value Find base table primary key and unique constraints where all columns probably have a static default value. Candidate key columns (columns that belong to the primary key or to an unique constraints) shouldn't have static default values unless you are enforcing a rule that a table can have at most one row. The point of default values is that system assigns them automatically. There cannot be multiple rows with the same key value. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
124 Cannot accommodate all the fractional seconds in case of table columns The precision of a timestamp type of a column must be able to accommodate all the fractional seconds of the default value of the column. Find table columns with the type timestamp without time zone(m) or timestamp with time zone(m) that have a default value LOCALTIMESTAMP(n) or CURRENT_TIMESTAMP(n) WHERE n>m. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
125 Cannot register all legal e-mail addresses Find CHECK constraints on base table or foreign table columns that contain data about e-mail addresses and apply unnecessary restrictions to the these, rejecting potentially some legal addresses. More precisely, find CHECK constraints that prevent registration of e-mail addresses with multiple @ signs. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
126 Cascading update is not needed (based on surrogate keys) Find foreign key constraints that reference to a candidate key that is a surrogate key, i.e., its values are generated by the system by using sequence generators. Do not use ON UPDATE CASCADE, ON UPDATE SET NULL, and ON UPDATE SET DEFAULT in case of foreign keys that reference to surrogate keys. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
127 Case-insensitive regular expressions (~* or !~*) containing both uppercase and lowercase letters This query identifies database objects (table and domain CHECK constraints, trigger WHEN conditions, rules, views, materialized views, and user-defined routines) that use a case-insensitive regular expression operator (~* or !~*), yet contain both uppercase and lowercase letters inside the regular expression pattern (for example, col ~* '^[A-Z][a-z]+$', col ~* '^[ab].*[C-D]', or col ~* '^[a-zA-Z0-9]+$').

Combining a case-insensitive operator with a mixed-case regular expression pattern indicates one of two issues:

  • Incorrect operator (broken case validation): The developer intended to enforce distinct case rules for different parts of the string (such as requiring an uppercase letter in one position and a lowercase letter in another, e.g., '^[C].*[a-z]' or '^\$2[abxy]\$[0-9]{2}\$[./A-Za-z0-9]{53}$'), but mistakenly used ~* (or !~*) instead of the case-sensitive operator ~ (or !~). Because ~* disables case sensitivity across the entire pattern, the intended case restrictions are silently bypassed.

  • Redundant or inconsistent pattern style: The developer genuinely intended case-insensitive matching, but redundantly specified both letter cases (such as a-zA-Z) or mixed uppercase and lowercase characters inconsistently within the pattern.

Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
128 Case insensitive search Refers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. Find user-defined routines and derived tables (views/materialized views) that have a subquery with case insensitive search (by using the upper or lower function or ILIKE predicate or (?i) modifier of a regular expression pattern). General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
129 Case sensitive and case insensitive uniqueness of the same simple key Find sets of columns that have both case sensitive and case insesitive unique constraints enforced based on these columns. In case of textual columns uniqueness could be checked either in case sensitive or case insensitive way. It is a contradiction to check the uniqueneness in both ways in case of the same key. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
130 Chains of ON DELETE CASCADE This query identifies referential paths (chains of foreign key relationships) where every constraint in the path is configured with ON DELETE CASCADE. The analysis is intended to uncover potential transitive deletion risks, where a single DELETE operation on a root table could trigger a catastrophic, cascading data loss across multiple, deeply-nested tables. The length of such chains is a key indicator of architectural fragility. General system catalog base tables only MIT (opens in new tab) View
131 CHAR columns have a default value that length is shorter from the character maximum length of the column Choose a suitable data type, field size, and default value. If the default value is shorter from the character maximum length, then spaces will be added to the end of the registered value. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
132 CHAR or VARCHAR columns have a default value that length is longer from the character maximum length of the column Find table columns with CHAR or VARCHAR type that have a default value that length is longer from the character maximum length of the column. Choose a suitable data type, field size, and default value. If the value is longer, then it is impossible to register it in a field, i.e., it makes registration of data impossible (except if the excessive characters are spaces). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
133 Check as to wheteher the names of columns are in the plural or in the singular form (English version) Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
134 Check as to wheteher the names of columns are in the plural or in the singular form (English version) (aggregate view) Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of columns that name is in plural or in singular by table type. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
135 Check as to wheteher the names of columns are in the plural or in the singular form (Estonian version) Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
136 Check as to wheteher the names of parameters are in the plural or in the singular form (English version) Check as to wheteher the names of routine parameters are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
137 Check as to wheteher the names of parameters are in the plural or in the singular form (Estonian version) Check as to wheteher the names of routine parameters are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
138 Check as to wheteher the names of tables are in the plural or in the singular form (English version) Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
139 Check as to wheteher the names of tables are in the plural or in the singular form (English version) (aggregate view) Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of tables that name is in plural or in singular by table type. Sofware measure INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
140 Check as to wheteher the names of tables are in the plural or in the singular form (Estonian version) Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View