Filter 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.
#561. Names of database objects that perhaps end with a sequence number (3)
INFORMATION_SCHEMA+system catalog base tablesThis query identifies user-defined database objects that share a common container and a common base name, where the identifiers are distinguished solely by numerical suffixes (e.g., columns address1, address2 in the same table or tables address1 and address2 in the same schema). Such a structure complicates querying (e.g., requiring checks across multiple columns or tables) and is difficult to scale. The correct approach is for example to create a separate table for the repeating attribute, establishing a one-to-many relationship with the parent table.
#562. Names of database objects that perhaps end with a sequence number (aggregate view)
INFORMATION_SCHEMA+system catalog base tablesThis query provides a statistical overview of a potential naming convention issue by counting the number of user-defined database object identifiers that terminate in one or two numerical digits. This naming pattern is a design smell, often indicating bad database structure or semantic ambiguity. Instead of listing each individual name, the query returns an aggregate count, which is useful for quickly assessing the overall prevalence of this issue within the schema and tracking remediation progress over time.
#563. Names of database objects that start with an underscore
INFORMATION_SCHEMA+system catalog base tablesImprove the readability of names. Find the names (identifiers) of user-defined database objects that start with an underscore. This is not necessarily a mistake. For instance, parameter names could start with an underscore. On the other hand, it could be that the prefix is missing in the name.
#564. Names of database objects with four or more consecutive identical symbols
INFORMATION_SCHEMA+system catalog base tablesFind names of database objects with four or more consecutive identical symbols
#565. Names of database objects with perhaps too many digits
INFORMATION_SCHEMA+system catalog base tablesFind the names of database objects where more than half the signs are digits.
#566. Names of database objects with perhaps too many subcomponents (terms)
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 number of subcomponents (terms) should not be too big. Find the names (identifiers) of user-defined database objects that perhaps contain too many subcomponents, assuming, that the separator of the components is "_".
#567. Names of database objects with perhaps too many subcomponents (terms) that consist of only consonants
INFORMATION_SCHEMA+system catalog base tablesFind names of database objects where the number of subcomponents (terms) that consist of only consonants is bigger than the number of subcomponents that contain at least one vowel.
#568. Names of the columns of derived tables that have been given by the system
INFORMATION_SCHEMA+system catalog base tablesFind columns of derived tables that name has been given by the system. The creators of the table should specify the name themselves to avoid ugly names and nasty surprises.
#569. Names of the password columns
INFORMATION_SCHEMA+system catalog base tablesFind names of columns of base tables, views, and materialized views that contain passwords. Make sure that the naming is consistent,
#570. Names of triggers and rules that do contain the table name
INFORMATION_SCHEMA+system catalog base tablesThe names should contain table name in order to make the names better understandable.
#571. Names of triggers and rules that do not contain the table name
INFORMATION_SCHEMA+system catalog base tablesThe names should contain table name in order to make the names better understandable.
#572. Names potentially referring to multiple concepts (broader scope)
INFORMATION_SCHEMA+system catalog base tablesThis query identifies user-defined database objects (tables, views, columns, routines, parameters, constraints, triggers, domains, and types) whose names contain the coordinating conjunctions "and" (English) or "ja" (Estonian), either separated by underscores (_and_, _ja_) or written in camelCase/PascalCase (...And..., ...Ja...). The presence of a conjunction in an identifier typically indicates that a single database object is overloaded with multiple concepts or responsibilities:
- Columns: Suggests a violation of First Normal Form (1NF) and attribute atomicity (e.g., storing multiple distinct values in one column, such as phone_and_email).
- Routines and Triggers: Suggests a violation of the Single Responsibility Principle (SRP), indicating that a function or trigger performs multiple coupled tasks instead of one well-defined operation.
- Constraints: Suggests that multiple independent business rules are bundled into a single CHECK constraint, making it harder to identify which specific rule failed when an exception is raised.
- Tables and Views: Suggests poor cohesion where distinct entities are merged into a single relation.
Names where "and" or "ja" merely defines the lower and upper bounds of a single range (such as between_1_and_10 or vahemikus_3_ja_6) are excluded, as they describe one cohesive interval rule rather than multiple concepts.
#573. Names potentially referring to multiple concepts (narrower scope)
INFORMATION_SCHEMA+system catalog base tablesThis query identifies user-defined database objects—specifically tables, columns, routine parameters, multi-column CHECK constraints, domains, and custom types—whose names contain the coordinating conjunctions "and" (English) or "ja" (Estonian), either separated by underscores (_and_, _ja_) or written in camelCase/PascalCase (...And..., ...Ja...). The presence of a conjunction in an identifier typically indicates that a single database object is overloaded with multiple concepts or responsibilities:
- Columns: Suggests a violation of First Normal Form (1NF) and attribute atomicity (e.g., storing multiple distinct values in one column, such as
phone_and_email). - Multi-column CHECK constraints: Suggests that multiple independent business rules are bundled into a single
CHECKconstraint, making it harder to identify which specific rule failed when an exception is raised. - Tables: Suggests poor cohesion where distinct entities are merged into a single relation.
- Domains, types, and parameters: Suggests composite or overloaded definitions that lack single-responsibility clarity.
Names where
"and" or "ja" merely defines the lower and upper bounds of a single range (such as between_1_and_10 or vahemikus_3_ja_6) are excluded, as they describe one cohesive interval rule rather than multiple concepts.
#574. Name starts or ends with spaces
INFORMATION_SCHEMA+system catalog base tablesFind the names of user-defined database objects (must be delimited identifiers) that start or end with spaces.
#575. Naming of declarative base table constraints
INFORMATION_SCHEMA+system catalog base tablesFind the names of declarative base table constraints. Naming of constraints must be consistent. For instance, do not mix system-defined and user-defined names.
#576. Naming of tables
INFORMATION_SCHEMA+system catalog base tablesFind the names of different types (base table, foreign table, view, materialized view) of tables. Naming of tables must be consistent. For instance, do not mix names in plural and singular form within the same table type.
#577. No need to use to_date or to_timestamp function
INFORMATION_SCHEMA+system catalog base tablesFind expressions where a date literal with the ISO format is converted to date/timestamp by using to_date or to_timestamp function.
#578. Non-foreign key columns that have no associated CHECK constraints
INFORMATION_SCHEMA onlyFind what are the base table columns that are not foreign key columns and that have no associated CHECK constraints? Perhaps some CHECK constraints are missing.
#579. Non-foreign key indexes that have been named as foreign key indexes
INFORMATION_SCHEMA+system catalog base tablesFind indexes that are not on a foreign key column but the name of the index contains ixfk or idxfk.
#580. Non-inherited columns with a CHECK constraint permitting only a single constant value
INFORMATION_SCHEMA+system catalog base tablesThis query identifies non-inherited columns of base tables and foreign tables that have a single-column table or domain CHECK constraint restricting the column to only one fixed value (for example, col = 5, col = 'test', or VALUE = false).
Restricting a column to a single constant value is typically a schema design flaw or a mistake in the constraint expression (such as using the equality operator = instead of LIKE, ~, IN (...), or a range operator, as in a = 'a%'). Storing an identical constant in every row of a multi-row table also wastes storage and obscures the data model.
Columns inherited from a supertable are explicitly excluded from the results, because applying a single-value CHECK constraint to an inherited column on a subtable is a valid pattern for fixing a subtype discriminator or specialized attribute value. The main remaining legitimate exception is a constraint combined with a PRIMARY KEY or UNIQUE constraint to enforce a singleton table that can contain at most one row (e.g., id = 1).
| # | 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 |
|---|---|---|---|---|---|---|---|
| 561 | Names of database objects that perhaps end with a sequence number (3) | This query identifies user-defined database objects that share a common container and a common base name, where the identifiers are distinguished solely by numerical suffixes (e.g., columns address1, address2 in the same table or tables address1 and address2 in the same schema). Such a structure complicates querying (e.g., requiring checks across multiple columns or tables) and is difficult to scale. The correct approach is for example to create a separate table for the repeating attribute, establishing a one-to-many relationship with the parent table. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 562 | Names of database objects that perhaps end with a sequence number (aggregate view) | This query provides a statistical overview of a potential naming convention issue by counting the number of user-defined database object identifiers that terminate in one or two numerical digits. This naming pattern is a design smell, often indicating bad database structure or semantic ambiguity. Instead of listing each individual name, the query returns an aggregate count, which is useful for quickly assessing the overall prevalence of this issue within the schema and tracking remediation progress over time. | Sofware measure | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 563 | Names of database objects that start with an underscore | Improve the readability of names. Find the names (identifiers) of user-defined database objects that start with an underscore. This is not necessarily a mistake. For instance, parameter names could start with an underscore. On the other hand, it could be that the prefix is missing in the name. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 564 | Names of database objects with four or more consecutive identical symbols | Find names of database objects with four or more consecutive identical symbols | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 565 | Names of database objects with perhaps too many digits | Find the names of database objects where more than half the signs are digits. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 566 | Names of database objects with perhaps too many subcomponents (terms) | "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 number of subcomponents (terms) should not be too big. Find the names (identifiers) of user-defined database objects that perhaps contain too many subcomponents, assuming, that the separator of the components is "_". | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 567 | Names of database objects with perhaps too many subcomponents (terms) that consist of only consonants | Find names of database objects where the number of subcomponents (terms) that consist of only consonants is bigger than the number of subcomponents that contain at least one vowel. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 568 | Names of the columns of derived tables that have been given by the system | Find columns of derived tables that name has been given by the system. The creators of the table should specify the name themselves to avoid ugly names and nasty surprises. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 569 | Names of the password columns | Find names of columns of base tables, views, and materialized views that contain passwords. Make sure that the naming is consistent, | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 570 | Names of triggers and rules that do contain the table name | The names should contain table name in order to make the names better understandable. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 571 | Names of triggers and rules that do not contain the table name | The names should contain table name in order to make the names better understandable. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 572 | Names potentially referring to multiple concepts (broader scope) | This query identifies user-defined database objects (tables, views, columns, routines, parameters, constraints, triggers, domains, and types) whose names contain the coordinating conjunctions "and" (English) or "ja" (Estonian), either separated by underscores (_and_, _ja_) or written in camelCase/PascalCase (...And..., ...Ja...). The presence of a conjunction in an identifier typically indicates that a single database object is overloaded with multiple concepts or responsibilities:
Names where "and" or "ja" merely defines the lower and upper bounds of a single range (such as between_1_and_10 or vahemikus_3_ja_6) are excluded, as they describe one cohesive interval rule rather than multiple concepts. |
Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 573 | Names potentially referring to multiple concepts (narrower scope) | This query identifies user-defined database objects—specifically tables, columns, routine parameters, multi-column CHECK constraints, domains, and custom types—whose names contain the coordinating conjunctions "and" (English) or "ja" (Estonian), either separated by underscores (_and_, _ja_) or written in camelCase/PascalCase (...And..., ...Ja...). The presence of a conjunction in an identifier typically indicates that a single database object is overloaded with multiple concepts or responsibilities:
Names where "and" or "ja" merely defines the lower and upper bounds of a single range (such as between_1_and_10 or vahemikus_3_ja_6) are excluded, as they describe one cohesive interval rule rather than multiple concepts. |
Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 574 | Name starts or ends with spaces | Find the names of user-defined database objects (must be delimited identifiers) that start or end with spaces. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 575 | Naming of declarative base table constraints | Find the names of declarative base table constraints. Naming of constraints must be consistent. For instance, do not mix system-defined and user-defined names. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 576 | Naming of tables | Find the names of different types (base table, foreign table, view, materialized view) of tables. Naming of tables must be consistent. For instance, do not mix names in plural and singular form within the same table type. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 577 | No need to use to_date or to_timestamp function | Find expressions where a date literal with the ISO format is converted to date/timestamp by using to_date or to_timestamp function. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 578 | Non-foreign key columns that have no associated CHECK constraints | Find what are the base table columns that are not foreign key columns and that have no associated CHECK constraints? Perhaps some CHECK constraints are missing. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View | |
| 579 | Non-foreign key indexes that have been named as foreign key indexes | Find indexes that are not on a foreign key column but the name of the index contains ixfk or idxfk. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View | |
| 580 | Non-inherited columns with a CHECK constraint permitting only a single constant value | This query identifies non-inherited columns of base tables and foreign tables that have a single-column table or domain CHECK constraint restricting the column to only one fixed value (for example, col = 5, col = 'test', or VALUE = false).Restricting a column to a single constant value is typically a schema design flaw or a mistake in the constraint expression (such as using the equality operator = instead of LIKE, ~, IN (...), or a range operator, as in a = 'a%'). Storing an identical constant in every row of a multi-row table also wastes storage and obscures the data model.Columns inherited from a supertable are explicitly excluded from the results, because applying a single-value CHECK constraint to an inherited column on a subtable is a valid pattern for fixing a subtype discriminator or specialized attribute value. The main remaining legitimate exception is a constraint combined with a PRIMARY KEY or UNIQUE constraint to enforce a singleton table that can contain at most one row (e.g., id = 1). |
Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View |