Filter Queries

Found 1041 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 relatively small amount of data, which is in the system catalog of a database.
  • Statistics about the catalog content and project home in GitHub that has additional information.

# Name Goal Type Data source Last update License
541 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. Problem detection INFORMATION_SCHEMA only 2025-11-07 10:11 MIT License View
542 Is does not return a boolean This query identifies user-defined SQL and PL/pgSQL routines (excluding triggers) that exhibit a semantic inconsistency between their name and return type. It flags non-trigger routines whose names begin with a predicate prefix (e.g., is_, has_, can_, on_) but whose defined return type is not BOOLEAN. Such a mismatch violates the principle of self-documenting code, as the name creates a strong expectation of a TRUE/FALSE return value, which the routine's signature then contradicts. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-13 14:03 MIT License View
543 IS NOT DISTINCT FROM in derived tables Avoid using IS NOT DISTINCT FROM because it makes the query planner to avoid using an index. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
544 IS NOT DISTINCT FROM in routines Avoid using IS NOT DISTINCT FROM because it makes the query planner to avoid using an index. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
545 IS NULL check is probably not needed Find CHECK constraints that refer only to mandatory columns but the Boolean expression has IS NULL condition. Problem detection INFORMATION_SCHEMA only 2025-11-07 10:11 MIT License View
546 JSON type instead of JSONB type "In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys." (https://www.postgresql.org/docs/current/datatype-json.html) Problem detection INFORMATION_SCHEMA only 2025-11-07 10:11 MIT License View
547 LEAKPROOF routines that are perhaps not leakproof You should not give wrong information to the database management system. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
548 Length and char_length functions are used within the same expression This query identifies expressions that use both the length() and char_length() functions, which is a strong indicator of a logical flaw. Since these functions are functional synonyms in PostgreSQL (both returning the character count), an expression that compares their results (e.g., length(col) > char_length(col)) may be either tautological or will always evaluate to false. Such code is typically written under the mistaken assumption that length() returns bytes, a behavior seen in other database management systems. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-13 13:12 MIT License View
549 Lifecycle not initiated Find non-primary key and non-unique base table foreign key columns that name refers to the possibility that these are used to register references to a state classifier. The column must belong to a foreign key and does not have a default value. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
550 LIKE instead of = Find expressions that use LIKE predicate for precise comparison. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
551 LIKE with a regular expression pattern Find expressions that use LIKE (including ILIKE) predicate with a regular expression patterns. In a LIKE pattern one can use only _ and % metasymbols to construct a pattern. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
552 LIKE without a pattern with % or _ Find expressions that use LIKE predicate witout a pattern that contains at least one % or _ sign. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
553 Mandatory columns for holding large textual values (comments, descriptions, etc.) Find mandatory (NOT NULL) base table columns that name, column type, and field size refers to the possibility that these are used to register large textual values like comments, descriptions, and explanations. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
554 Many-to-many relationship types that do not have additional attributes Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table are either foreign key columns or a surrogate key column. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
555 Many-to-many relationship types that do not permit repeating relationships and do not have additional attributes Find base tables that implement many-to-many relationship types that do not permit repeating relationships. More specifically find tables that have two or more foreign keys and all the columns of the table belong to a foreign key. In addition, all the table columns must be covered by a primary key or unique constraint. It could be that during the system analysis a mistake has been made and some attributes of the entity type that represents the relationship type have not been discovered. Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
556 Many-to-many tables that need conceptual renaming This query identifies junction tables (implementing a binary relationship via two foreign keys) whose names are simple concatenations of the parent table names (e.g., Course_Lecturer). This naming style is flagged as a design smell because it merely describes the physical implementation rather than the conceptual relationship being modeled. The recommended best practice is to rename such tables to reflect the domain concept they represent. For instance, the relationship between Course and Lecturer should be named after the activity it represents, such as Teaching or Course_Assignment. Problem detection system catalog base tables only 2025-11-15 09:45 MIT License View
557 Many-to-many tables that perhaps need conceptual renaming This query identifies junction tables (implementing a binary relationship via two foreign keys) whose names are simple concatenations of the parent table names, often with minor variations (e.g., Courses_Lecturer). This naming convention is a design smell as it describes the physical implementation rather than the conceptual relationship being modeled. The recommended best practice is to rename such tables to reflect the domain concept they represent. For instance, the relationship between Course and Lecturer should be named after the activity it represents, such as Teaching or Course_Assignment. Problem detection system catalog base tables only 2025-11-15 09:46 MIT License View
558 Meaningless terms in derived tables Find derived tables that subquery contains terms "foo", "bar", "foobar", or "baz". Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
559 Meaningless terms in names Find names of database objects that contain terms "foo", "bar", "foobar", or "baz". Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View
560 Meaningless terms in routines Find routines that subquery contains terms "foo", "bar", "foobar", or "baz". Problem detection INFORMATION_SCHEMA+system catalog base tables 2025-11-07 10:11 MIT License View