Filter Queries

Found 1092 queries.

Page 35 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.

#681. Perhaps a unneccessary surrogate key

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have the primary key that is not a surrogate key and an alternate key that is a surrogate key. Perhaps the surrogate key column is not needed.

Problem detection License: MIT (opens in new tab)

#682. Perhaps brackets are missing in a regular expression that uses OR logical operation

INFORMATION_SCHEMA+system catalog base tables

Find regular expressions where choice between alternatives has no brackets. Thus, instead of '(a|b|c)' there is 'a|b|c'. An example: '^a|b|c$' -permits in the string symbol "|" but '^(a|b|c)$' does not permit in the string symbol "|".

Problem detection License: MIT (opens in new tab)

#683. Perhaps check constraint names contain incorrect or unnecessary words

INFORMATION_SCHEMA+system catalog base tables

Find names of check constraints (either associated with a base table or a domain) that names contain words that are not needed in the name. For instance, constraints cannot ensure the correctness of data and thus the word correct should not be used in the names. Words like "valid" or phrases like "follows_rules" are just noise because all the constraint ensure that the registered data values are valid and follow certain rules.

Problem detection License: MIT (opens in new tab)

#684. Perhaps checking of file extension is incorrect

INFORMATION_SCHEMA only

Find check constraints of tables that use a regular expression to check as to whether a registered string ends with an appropriate file extension. However, the expression does not put the dot sign into the square brackets nor does have the escape character \before it, i.e., it is interpreted as a single character not as the dot sign in the expression. In regular expressions the dot (.) matches any single character except the newline character.

Problem detection License: MIT (opens in new tab)

#685. Perhaps CHECK should be associated with a domain

INFORMATION_SCHEMA+system catalog base tables

Find cases where multiple columns with the same domain have exactly the same CHECK constraint that is directly associated with the table.

Problem detection License: MIT (opens in new tab)

#686. Perhaps excessive privileges to use base tables

INFORMATION_SCHEMA+system catalog base tables

Find excessive privileges to use base tabes (for others than the owner of the base table). The excessive privileges are all that are not SELECT, INSERT, UPDATE, DELETE.

Problem detection License: MIT (opens in new tab)

#687. Perhaps excessive privileges to use views

INFORMATION_SCHEMA+system catalog base tables

Find non-SELECT privileges to use views (for others than the owner of the view). Perhaps there should be only the privilege to make queries (SELECT statements based on the views) and data modification takes place by using routines. REFERENCES and TRIGGER privileges are definitely not needed.

Problem detection License: MIT (opens in new tab)

#688. Perhaps inconsistent use of temporal functions

INFORMATION_SCHEMA+system catalog base tables

Find routines that use temporal functions CURRENT_TIMESTAMP, LOCALTIMESTAMP, or now() that is inconsistent with the default values of the columns that are used by the routine, e.g., function uses a column with the default value LOCALTIMESTAMP but the routine uses function CURRENT_TIMESTAMP or now().

Problem detection License: MIT (opens in new tab)

#689. Perhaps inconsistent use of temporal functions (2)

INFORMATION_SCHEMA+system catalog base tables

Find as to whether in the same database more than one of these functions is used at the same time - now(), localtimestamp, current_timestamp.

Problem detection License: MIT (opens in new tab)

#690. Perhaps incorrect check of permitted temporal values

INFORMATION_SCHEMA+system catalog base tables

This query identifies potentially flawed CHECK constraints on columns of type timestamp or a timestamp range (e.g., tstzrange, daterange). It targets range checks where the upper bound of the value or the range is defined using an inclusive operator (<=). This is a common source of bugs, as a condition like column <= '2025-12-31' or UPPER(column) <= '2025-12-31' is interpreted as being up to 00:00:00 on that day, inadvertently excluding the entire last day of the intended period. The more robust pattern is to use an exclusive upper bound, such as column < '2026-01-01'.

Problem detection License: MIT (opens in new tab)

#691. Perhaps incorrect column name (based on default values)

INFORMATION_SCHEMA only

This query identifies a semantic mismatch between column definitions and their identifiers. It flags base table columns that are configured with a DEFAULT value of CURRENT_USER or SESSION_USER (indicating they store user identity) but whose names fail to reflect this purpose. Specifically, it searches for columns lacking semantic cues such as "user", "login", "owner", or "by" in their names. This obscuration reduces schema self-documentation, as developers cannot intuitively determine that the column is intended for audit or ownership tracking.

Problem detection License: MIT (opens in new tab)

#692. Perhaps incorrect default vale

INFORMATION_SCHEMA only

Find columns of base tables that have default value CURRENT_USER.

Problem detection License: MIT (opens in new tab)

#693. Perhaps incorrect use of 'NULL'

INFORMATION_SCHEMA+system catalog base tables

Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value.

Problem detection License: MIT (opens in new tab)

#694. Perhaps incorrect WHEN clause

INFORMATION_SCHEMA only

Find row level triggers that have action condition (WHEN clause) but the Boolean expression in its specifications does not refer to neither NEW nor OLD variable.

Problem detection License: MIT (opens in new tab)

#695. Perhaps IS DISTINCT FROM should be used instead of <> in WHEN clauses

INFORMATION_SCHEMA only

Use a right predicate in trigger condition in order to ensure that the trigger executes always when it has to but not more often. IS DISTINCT FROM treats NULL as if it was a known value, rather than unknown. It would be relevant if a column that is referenced in the action condition is optional, i.e., permits NULLs.

General License: MIT (opens in new tab)

#696. Perhaps is not snake_case - Boolean-indicating prefix without underscore

INFORMATION_SCHEMA+system catalog base tables

This query identifies database identifiers (types, domains, columns, parameters) that likely violate the snake_case naming convention. It operates on a specific heuristic, flagging any name that begins with a common predicate prefix (is, has, on) but is not immediately followed by an underscore. This pattern is a strong indicator of camelCase (e.g., isActive) or PascalCase (e.g., IsActive) usage, both of which should be refactored to snake_case (e.g., is_active) to maintain a consistent and readable schema.

Problem detection License: MIT (opens in new tab)

#697. Perhaps is not snake_case - id, code, key, or nr is not followed by an underscore

INFORMATION_SCHEMA+system catalog base tables

Find names that perhaps do not use the snake_case naming style because the name starts with the phrase "id", "uuid", "code" , "kood", "key", or "nr" that is not followed by an underscore. Prefer snake_case over PascalCase and camelCase in names.

Problem detection License: MIT (opens in new tab)

#698. Perhaps is not snake_case - id, code, key, or nr is not preceded by an underscore

INFORMATION_SCHEMA+system catalog base tables

Find names that perhaps do not use the snake_case naming style because the name ends with the phrase "id", "uuid", "code", "kood", "key", or "nr" that is not preceded by an underscore. Prefer snake_case over PascalCase and camelCase in names.

Problem detection License: MIT (opens in new tab)

#699. Perhaps is not snake_case - long subsections without underscores

INFORMATION_SCHEMA+system catalog base tables

Find names that perhaps do not use the snake_case naming style because the name contains a long subsection (at least 20 characters) without underscores. Prefer snake_case over PascalCase and camelCase in names.

Problem detection License: MIT (opens in new tab)

#700. Perhaps last update time trigger is missing

INFORMATION_SCHEMA+system catalog base tables

Find base tables that have a column for last update time but the table does not have associated before update row level trigger for changing the last update time.

Problem detection 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
681 Perhaps a unneccessary surrogate key Find base tables that have the primary key that is not a surrogate key and an alternate key that is a surrogate key. Perhaps the surrogate key column is not needed. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
682 Perhaps brackets are missing in a regular expression that uses OR logical operation Find regular expressions where choice between alternatives has no brackets. Thus, instead of '(a|b|c)' there is 'a|b|c'. An example: '^a|b|c$' -permits in the string symbol "|" but '^(a|b|c)$' does not permit in the string symbol "|". Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
683 Perhaps check constraint names contain incorrect or unnecessary words Find names of check constraints (either associated with a base table or a domain) that names contain words that are not needed in the name. For instance, constraints cannot ensure the correctness of data and thus the word correct should not be used in the names. Words like "valid" or phrases like "follows_rules" are just noise because all the constraint ensure that the registered data values are valid and follow certain rules. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
684 Perhaps checking of file extension is incorrect Find check constraints of tables that use a regular expression to check as to whether a registered string ends with an appropriate file extension. However, the expression does not put the dot sign into the square brackets nor does have the escape character \before it, i.e., it is interpreted as a single character not as the dot sign in the expression. In regular expressions the dot (.) matches any single character except the newline character. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
685 Perhaps CHECK should be associated with a domain Find cases where multiple columns with the same domain have exactly the same CHECK constraint that is directly associated with the table. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
686 Perhaps excessive privileges to use base tables Find excessive privileges to use base tabes (for others than the owner of the base table). The excessive privileges are all that are not SELECT, INSERT, UPDATE, DELETE. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
687 Perhaps excessive privileges to use views Find non-SELECT privileges to use views (for others than the owner of the view). Perhaps there should be only the privilege to make queries (SELECT statements based on the views) and data modification takes place by using routines. REFERENCES and TRIGGER privileges are definitely not needed. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
688 Perhaps inconsistent use of temporal functions Find routines that use temporal functions CURRENT_TIMESTAMP, LOCALTIMESTAMP, or now() that is inconsistent with the default values of the columns that are used by the routine, e.g., function uses a column with the default value LOCALTIMESTAMP but the routine uses function CURRENT_TIMESTAMP or now(). Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
689 Perhaps inconsistent use of temporal functions (2) Find as to whether in the same database more than one of these functions is used at the same time - now(), localtimestamp, current_timestamp. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
690 Perhaps incorrect check of permitted temporal values This query identifies potentially flawed CHECK constraints on columns of type timestamp or a timestamp range (e.g., tstzrange, daterange). It targets range checks where the upper bound of the value or the range is defined using an inclusive operator (<=). This is a common source of bugs, as a condition like column <= '2025-12-31' or UPPER(column) <= '2025-12-31' is interpreted as being up to 00:00:00 on that day, inadvertently excluding the entire last day of the intended period. The more robust pattern is to use an exclusive upper bound, such as column < '2026-01-01'. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
691 Perhaps incorrect column name (based on default values) This query identifies a semantic mismatch between column definitions and their identifiers. It flags base table columns that are configured with a DEFAULT value of CURRENT_USER or SESSION_USER (indicating they store user identity) but whose names fail to reflect this purpose. Specifically, it searches for columns lacking semantic cues such as "user", "login", "owner", or "by" in their names. This obscuration reduces schema self-documentation, as developers cannot intuitively determine that the column is intended for audit or ownership tracking. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
692 Perhaps incorrect default vale Find columns of base tables that have default value CURRENT_USER. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
693 Perhaps incorrect use of 'NULL' Find Boolean expressions, queries, routines, and default values that refer to value 'NULL'. Perhaps NULL was intended instead. 'NULL' is a string (a value) but NULL is a special marker for denoting missing value. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
694 Perhaps incorrect WHEN clause Find row level triggers that have action condition (WHEN clause) but the Boolean expression in its specifications does not refer to neither NEW nor OLD variable. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View
695 Perhaps IS DISTINCT FROM should be used instead of <> in WHEN clauses Use a right predicate in trigger condition in order to ensure that the trigger executes always when it has to but not more often. IS DISTINCT FROM treats NULL as if it was a known value, rather than unknown. It would be relevant if a column that is referenced in the action condition is optional, i.e., permits NULLs. General INFORMATION_SCHEMA only MIT (opens in new tab) View
696 Perhaps is not snake_case - Boolean-indicating prefix without underscore This query identifies database identifiers (types, domains, columns, parameters) that likely violate the snake_case naming convention. It operates on a specific heuristic, flagging any name that begins with a common predicate prefix (is, has, on) but is not immediately followed by an underscore. This pattern is a strong indicator of camelCase (e.g., isActive) or PascalCase (e.g., IsActive) usage, both of which should be refactored to snake_case (e.g., is_active) to maintain a consistent and readable schema. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
697 Perhaps is not snake_case - id, code, key, or nr is not followed by an underscore Find names that perhaps do not use the snake_case naming style because the name starts with the phrase "id", "uuid", "code" , "kood", "key", or "nr" that is not followed by an underscore. Prefer snake_case over PascalCase and camelCase in names. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
698 Perhaps is not snake_case - id, code, key, or nr is not preceded by an underscore Find names that perhaps do not use the snake_case naming style because the name ends with the phrase "id", "uuid", "code", "kood", "key", or "nr" that is not preceded by an underscore. Prefer snake_case over PascalCase and camelCase in names. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
699 Perhaps is not snake_case - long subsections without underscores Find names that perhaps do not use the snake_case naming style because the name contains a long subsection (at least 20 characters) without underscores. Prefer snake_case over PascalCase and camelCase in names. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View
700 Perhaps last update time trigger is missing Find base tables that have a column for last update time but the table does not have associated before update row level trigger for changing the last update time. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View