Filter Queries

Found 1056 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 the relatively small amount of data in the system catalog of a database.

#481. Inconsistency of using column data types/field sizes in case of columns that implement relationships

INFORMATION_SCHEMA+system catalog base tables

Find foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.

Problem detection License: MIT (opens in new tab)

#482. Inconsistency of using parameter data types

INFORMATION_SCHEMA+system catalog base tables

Find parameters of routines that have the same name but a different type. Parameters that have the same name should have, in general, the same data type as well, assuming that the routines, which have the parameters, have different names, i.e., there is no overloading in play.

Problem detection License: MIT (opens in new tab)

#483. Inconsistent chain of relationships in terms of using ON UPDATE compensating action

system catalog base tables only

In case of a chain of relationships between tables (where the primary key and the foreign key have the same columns) the use of ON UPDATE compensating action should be consistent. For instance, in the next example there is inconsistency, because if one changes the person_code in table Person, then the modification does not succeed because it does not cascade to the table Product. It is unclear as to whether it should be possible to change the person_code or not. Person (person_code, surname) Primary key (person_code) Worker(person_code)
Primary key (person_code)
Foreign key (person_code) References Person (person_code) ON UPDATE CASCADE

Product(product_code, registrator)
Primary key (product_code)
Foreign key (registrator) References Worker (person_code) ON UPDATE NO ACTION

Problem detection License: MIT (opens in new tab)

#484. Inconsistent CHECK constraints for same-named columns

INFORMATION_SCHEMA+system catalog base tables

This query audits the schema for inconsistent data validation logic. It identifies non-foreign key base table columns that share the same identifier (name) across different tables but enforce a divergent set of single-column CHECK constraints. According to the "Clean Code" principle of consistency, a recurring attribute name (e.g., status_code) implies a shared domain concept and should be subject to identical validity rules globally. Discrepancies indicate that business rules are being applied unevenly, potentially compromising data integrity.

Problem detection License: MIT (opens in new tab)

#485. Inconsistent CHECK constraints on columns with the same name

INFORMATION_SCHEMA+system catalog base tables

This query identifies inconsistencies in data validation for columns that share the same name across different tables. It flags cases where a conceptual data element (e.g., 'email', 'postal_code') is subject to a CHECK constraint in some tables but lacks one in others. This violates the principle of uniform data integrity, creates semantic ambiguity, and can allow invalid data to enter the system through the unconstrained columns.

Problem detection License: MIT (opens in new tab)

#486. Inconsistent data types for audit timestamps

INFORMATION_SCHEMA only

This query checks whether columns used to record registration and last update times have inconsistent data types across the database. Using varying data types for these temporal columns (for example, mixing timestamp and timestamptz) can lead to unexpected timezone behaviors and complicate time-based calculations.

Problem detection License: MIT (opens in new tab)

#487. Inconsistent data type usage in case of registering a date

INFORMATION_SCHEMA only

Find as to whether there are multiple different types used in case of columns that are meant for registering dates.

Problem detection License: MIT (opens in new tab)

#488. Inconsistent data type usage in case of registering a symbol

INFORMATION_SCHEMA only

Find whether the database uses both CHAR(1) and VARCHAR(1) columns to register a single symbol.

Problem detection License: MIT (opens in new tab)

#489. Inconsistent data type usage in case of registering sums of money

INFORMATION_SCHEMA only

Find as to whether both the numeric type and integer types are used in case of columns that are meant for register data about prices.

Problem detection License: MIT (opens in new tab)

#490. Inconsistent digit character class syntax in regular expressions

INFORMATION_SCHEMA+system catalog base tables

This query audits regular expressions within the database to detect syntactical inconsistencies in identifying numeric digits. It checks for the concurrent use of disparate character class notations: range-based ([0-9]), Perl-style shorthand (\d), and POSIX character classes ([[:digit:]]). While these are often functionally equivalent for standard ASCII digits, mixing multiple syntaxes within a single codebase indicates a lack of standardization, which reduces code readability and increases cognitive load during maintenance.

Problem detection License: MIT (opens in new tab)

#491. Inconsistent lengths in standard address columns

INFORMATION_SCHEMA only

This query checks whether columns storing standardized data—such as email addresses, phone numbers, IP addresses, postal codes, physical addresses, and file paths—have inconsistent field sizes across different tables. Identifying these discrepancies helps maintain a uniform database schema.

Problem detection License: MIT (opens in new tab)

#492. Inconsistent means to calculate tsvector values

INFORMATION_SCHEMA only

Find as to whether in the database there are multiple ways to calculate tsvector values, i.e., by using a generated column and by not using a generated column.

Problem detection License: MIT (opens in new tab)

#493. Inconsistent names of database objects that are used to manage the state of main objects in the database

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) The naming must be consistent. One should avoid mixing synonyms like "seisund", "staatus", and "olek" in Estonian or "state" and "status" in English and stick with one term. For instance, it is a bad practice to use word "state" in table names but word "status" in function names.

Problem detection License: MIT (opens in new tab)

#494. Inconsistent naming of columns with BOOLEAN type

INFORMATION_SCHEMA+system catalog base tables

This query audits the naming conventions of BOOLEAN columns to detect inconsistency. It checks whether the database contains a mix of styles: some boolean columns adhering to a semantic prefix convention (e.g., is_active, has_permission) and others using unprefixed nouns or adjectives (e.g., active, permission). The presence of both styles indicates a lack of a consistent standard, which can reduce schema clarity and predictability for developers.

Problem detection License: MIT (opens in new tab)

#495. Inconsistent naming of comment columns

INFORMATION_SCHEMA+system catalog base tables

Find columns of tables that start with the word comment or komment but end differently (excluding numbers). Return result only if there is more than one naming variant of such columns in the database. For instance, a column has the name "comment" but another "comments".

Problem detection License: MIT (opens in new tab)

#496. Inconsistent naming of registration time columns

INFORMATION_SCHEMA only

This query checks whether timestamp columns used to record registration times are named consistently across different tables. Maintaining a uniform naming convention (such as always using created_at or reg_time) significantly improves schema readability and maintainability.

Problem detection License: MIT (opens in new tab)

#497. Inconsistent naming of update time columns

INFORMATION_SCHEMA only

This query checks whether timestamp columns used to record last update times are named consistently across different tables. Using a uniform naming convention (such as consistently using updated_at or last_modified) significantly improves database schema readability and maintainability.

Problem detection License: MIT (opens in new tab)

#498. Inconsistent precision and scale usage in case of registering sums of money

INFORMATION_SCHEMA only

Find as to whether different precisions/scales are used in case of registering data about sums of money in different columns.

Problem detection License: MIT (opens in new tab)

#499. Inconsistent prefixing of generic column names

INFORMATION_SCHEMA+system catalog base tables

This query validates column naming consistency, specifically targeting generic attributes such as comments or descriptions. It flags tables that exhibit a mixed convention: containing both prefixed (e.g., table_comment) and unprefixed (e.g., description) generic columns within the same database context. This excludes primary and foreign keys. The goal is to enforce a uniform style—either consistently prefixing generic columns with the table name or consistently omitting the prefix—rather than allowing a hybrid approach.

Problem detection License: MIT (opens in new tab)

#500. Inconsistent prefixing of specific (non-generic) column names

INFORMATION_SCHEMA+system catalog base tables

This query audits the database for inconsistent column naming conventions, specifically focusing on non-generic, domain-specific attributes (excluding primary keys, foreign keys, and generic fields like 'comment'). It detects a hybrid naming strategy: some columns are prefixed with the table name (e.g., employee_salary) and others are not (e.g., hiring_date). This inconsistency suggests a lack of a standardized data dictionary, making query writing unpredictable.

Problem detection License: MIT (opens in new tab)
# Name(activate to sort ascending) Goal(activate to sort ascending) Type(sorted ascending, activate to sort descending) Data source(activate to sort ascending) Last update(activate to sort ascending) License Actions
481 Inconsistency of using column data types/field sizes in case of columns that implement relationships Find foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
482 Inconsistency of using parameter data types Find parameters of routines that have the same name but a different type. Parameters that have the same name should have, in general, the same data type as well, assuming that the routines, which have the parameters, have different names, i.e., there is no overloading in play. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
483 Inconsistent chain of relationships in terms of using ON UPDATE compensating action In case of a chain of relationships between tables (where the primary key and the foreign key have the same columns) the use of ON UPDATE compensating action should be consistent. For instance, in the next example there is inconsistency, because if one changes the person_code in table Person, then the modification does not succeed because it does not cascade to the table Product. It is unclear as to whether it should be possible to change the person_code or not. Person (person_code, surname) Primary key (person_code) Worker(person_code)
Primary key (person_code)
Foreign key (person_code) References Person (person_code) ON UPDATE CASCADE

Product(product_code, registrator)
Primary key (product_code)
Foreign key (registrator) References Worker (person_code) ON UPDATE NO ACTION
Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
484 Inconsistent CHECK constraints for same-named columns This query audits the schema for inconsistent data validation logic. It identifies non-foreign key base table columns that share the same identifier (name) across different tables but enforce a divergent set of single-column CHECK constraints. According to the "Clean Code" principle of consistency, a recurring attribute name (e.g., status_code) implies a shared domain concept and should be subject to identical validity rules globally. Discrepancies indicate that business rules are being applied unevenly, potentially compromising data integrity. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
485 Inconsistent CHECK constraints on columns with the same name This query identifies inconsistencies in data validation for columns that share the same name across different tables. It flags cases where a conceptual data element (e.g., 'email', 'postal_code') is subject to a CHECK constraint in some tables but lacks one in others. This violates the principle of uniform data integrity, creates semantic ambiguity, and can allow invalid data to enter the system through the unconstrained columns. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
486 Inconsistent data types for audit timestamps This query checks whether columns used to record registration and last update times have inconsistent data types across the database. Using varying data types for these temporal columns (for example, mixing timestamp and timestamptz) can lead to unexpected timezone behaviors and complicate time-based calculations. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
487 Inconsistent data type usage in case of registering a date Find as to whether there are multiple different types used in case of columns that are meant for registering dates. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
488 Inconsistent data type usage in case of registering a symbol Find whether the database uses both CHAR(1) and VARCHAR(1) columns to register a single symbol. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
489 Inconsistent data type usage in case of registering sums of money Find as to whether both the numeric type and integer types are used in case of columns that are meant for register data about prices. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
490 Inconsistent digit character class syntax in regular expressions This query audits regular expressions within the database to detect syntactical inconsistencies in identifying numeric digits. It checks for the concurrent use of disparate character class notations: range-based ([0-9]), Perl-style shorthand (\d), and POSIX character classes ([[:digit:]]). While these are often functionally equivalent for standard ASCII digits, mixing multiple syntaxes within a single codebase indicates a lack of standardization, which reduces code readability and increases cognitive load during maintenance. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
491 Inconsistent lengths in standard address columns This query checks whether columns storing standardized data—such as email addresses, phone numbers, IP addresses, postal codes, physical addresses, and file paths—have inconsistent field sizes across different tables. Identifying these discrepancies helps maintain a uniform database schema. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
492 Inconsistent means to calculate tsvector values Find as to whether in the database there are multiple ways to calculate tsvector values, i.e., by using a generated column and by not using a generated column. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
493 Inconsistent names of database objects that are used to manage the state of main objects in the database "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) The naming must be consistent. One should avoid mixing synonyms like "seisund", "staatus", and "olek" in Estonian or "state" and "status" in English and stick with one term. For instance, it is a bad practice to use word "state" in table names but word "status" in function names. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
494 Inconsistent naming of columns with BOOLEAN type This query audits the naming conventions of BOOLEAN columns to detect inconsistency. It checks whether the database contains a mix of styles: some boolean columns adhering to a semantic prefix convention (e.g., is_active, has_permission) and others using unprefixed nouns or adjectives (e.g., active, permission). The presence of both styles indicates a lack of a consistent standard, which can reduce schema clarity and predictability for developers. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
495 Inconsistent naming of comment columns Find columns of tables that start with the word comment or komment but end differently (excluding numbers). Return result only if there is more than one naming variant of such columns in the database. For instance, a column has the name "comment" but another "comments". Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
496 Inconsistent naming of registration time columns This query checks whether timestamp columns used to record registration times are named consistently across different tables. Maintaining a uniform naming convention (such as always using created_at or reg_time) significantly improves schema readability and maintainability. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
497 Inconsistent naming of update time columns This query checks whether timestamp columns used to record last update times are named consistently across different tables. Using a uniform naming convention (such as consistently using updated_at or last_modified) significantly improves database schema readability and maintainability. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
498 Inconsistent precision and scale usage in case of registering sums of money Find as to whether different precisions/scales are used in case of registering data about sums of money in different columns. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
499 Inconsistent prefixing of generic column names This query validates column naming consistency, specifically targeting generic attributes such as comments or descriptions. It flags tables that exhibit a mixed convention: containing both prefixed (e.g., table_comment) and unprefixed (e.g., description) generic columns within the same database context. This excludes primary and foreign keys. The goal is to enforce a uniform style—either consistently prefixing generic columns with the table name or consistently omitting the prefix—rather than allowing a hybrid approach. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
500 Inconsistent prefixing of specific (non-generic) column names This query audits the database for inconsistent column naming conventions, specifically focusing on non-generic, domain-specific attributes (excluding primary keys, foreign keys, and generic fields like 'comment'). It detects a hybrid naming strategy: some columns are prefixed with the table name (e.g., employee_salary) and others are not (e.g., hiring_date). This inconsistency suggests a lack of a standardized data dictionary, making query writing unpredictable. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)