| Goal | 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. |
|---|---|
| Notes | The query considers both column names in Estonian and in English. Queries PostgreSQL system catalogs (pg_class, pg_attribute, pg_constraint, pg_proc, pg_trigger, pg_type, pg_namespace, pg_rules, pg_event_trigger) and information_schema views to collect all user-defined database objects, excluding system schemas and objects belonging to extensions (pg_depend / pg_extension). The WHERE clause uses two regular expressions: a case-insensitive pattern (~*) to detect _ja_ and _and_ in snake_case names, and a case-sensitive pattern (~) to detect Ja and And preceded by a lowercase letter and followed by an uppercase letter in camelCase/PascalCase names. Negative lookbehinds ((? |
| Type | Problem detection Each row in the result could represent a flaw in the design |
| Reliability | Low Many false-positive results |
| License | MIT (opens in new tab) |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Fixing Suggestion
Refactor or rename the database object so that it represents a single, atomic concept or responsibility:
- For columns: Split the column into separate atomic attributes (e.g., replace first_and_last_name with first_name and last_name), or rename it to a single unifying term.
- For constraints: Split compound CHECK constraints into separate, individually named constraints so that each enforces a single business rule and produces an unambiguous error when violated.
- For routines and triggers: Decompose multi-purpose routines into focused, single-responsibility functions, or rename the routine to describe its single overarching business operation without using conjunctions.
Collections
This query belongs to the following collections:
Lexicon bad smells and linguistic antipatterns
Queries made to find the occurrences of lexicon bad smells and linguistic antipatterns
| Name | Description |
|---|---|
| Lexicon bad smells and linguistic antipatterns | Queries made to find the occurrences of lexicon bad smells and linguistic antipatterns |
Categories
This query is classified under the following categories:
Comfortability of database evolution
Queries of this category provide information about the means that influence database evolution.
Naming
Queries of this category provide information about the style of naming.
Result quality depends on names
Queries of this category use names (for instance, column names) to try to guess the meaning of a database object. Thus, the goodness of names determines the number of false positive and false negative results.
| Name | Description |
|---|---|
| Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
| Naming | Queries of this category provide information about the style of naming. |
| Result quality depends on names | Queries of this category use names (for instance, column names) to try to guess the meaning of a database object. Thus, the goodness of names determines the number of false positive and false negative results. |
Further reading and related materials:
Smell "Overloaded identifiers": Abebe, S.L., Haiduc, S., Tonella, P., Marcus, A., 2011. The effect of lexicon bad smells on concept location in source code. In 2011 IEEE 11th International Working Conference on Source Code Analysis and Manipulation (pp. 125-134). IEEE.
| Reference |
|---|
| Smell "Overloaded identifiers": Abebe, S.L., Haiduc, S., Tonella, P., Marcus, A., 2011. The effect of lexicon bad smells on concept location in source code. In 2011 IEEE 11th International Working Conference on Source Code Analysis and Manipulation (pp. 125-134). IEEE. |