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.

#301. Declaratively partitioned tables without partitions

INFORMATION_SCHEMA+system catalog base tables

Find declaratively partitioned tables that do not have any partitions. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10.

Problem detection License: MIT (opens in new tab)

#302. Declaratively partitioned tables with one partition

INFORMATION_SCHEMA+system catalog base tables

Find declaratively partitioned tables that have exactly one partition. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10. If there is only one partition, then it raises question as to why the additional complexity associated with partitioning is needed.

Problem detection License: MIT (opens in new tab)

#303. Do you really need fractional seconds?

INFORMATION_SCHEMA only

Find default values that return current timestamp with the maximum number of fractional seconds (6).

Problem detection License: MIT (opens in new tab)

#304. Deferrable foreign key constraint with a RESTRICT compensating action

system catalog base tables only

Find deferrable foreign key constraint with ON UPDATE RESTRICT or ON DELETE RESTRICT compensating action. Referential actions are carried out before, and are not part of, the checking of a referential constraint. Deferring a referential constraint defers the checking of the of the constraint (a ) but does not defer the referential actions of the referential constraint. In PostgreSQL the essential difference between NO ACTION and RESTRICT is that NO ACTION allows the check to be deferred until later in the transaction, whereas RESTRICT does not. Thus RESTRICT could result with the failure of data modification where in case of NO ACTION the modification would succeed.

Problem detection License: MIT (opens in new tab)

#305. Invocation of PL/pgSQL functions from the subqueries of derived tables

INFORMATION_SCHEMA+system catalog base tables

Find derived tables that subqueries invoke a PL/pgSQL function. Avoid context switch that is caused by the invocation of PL/pgSQL functions from the subqueries of derived tables.

Problem detection License: MIT (opens in new tab)

#306. Meaningless terms in derived tables

INFORMATION_SCHEMA+system catalog base tables

Find derived tables that subquery contains terms "foo", "bar", "foobar", or "baz".

Problem detection License: MIT (opens in new tab)

#307. Duplicate removal of duplicates in derived tables

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that contain both DISTINCT and GROUP BY. Make sure that the means for removing duplicate rows from the query result are not duplicated.

Problem detection License: MIT (opens in new tab)

#308. Derived tables with multiple DISTINCT's

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that contain more than one DISTINCT invocation. Make sure that the query is correctly written, including that it does not have unwanted formation of a Cartesian product.

General License: MIT (opens in new tab)

#309. Derived table presents the same data in the same way as a single base table

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that present data from one base table without adding columns, renaming columns, changing the order of columns, removing columns, or restricting rows. Perhaps something is missing from the subquery of the derived table.

Problem detection License: MIT (opens in new tab)

#310. Sorting rows based on random values in derived tables without limiting rows

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that sort rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation.

Problem detection License: MIT (opens in new tab)

#311. Sorting rows based on random values in derived tables

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that sort rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation.

Problem detection License: MIT (opens in new tab)

#312. Set operations that do not remove duplicate rows in derived tables

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views and materialized views) that use a set theoretic operation (union, except or intersect) in a manner that does not remove duplicate rows and thus can produce a multiset not a set. Make sure that it is what is needed.

General License: MIT (opens in new tab)

#313. Too wide derived (dependent) table

INFORMATION_SCHEMA+system catalog base tables

Find derived tables (views, materialized views) that are based on more than five tables and that have more than 15 columns. This view might produce "a denormalized world view" where all the data is together in one table and applications make queries based on this single view to fulfill their specific tasks. Such view does not follow the separation of concerns principle.

Problem detection License: MIT (opens in new tab)

#314. Derived tables with sorting

INFORMATION_SCHEMA+system catalog base tables

Find derived tables where the rows are ordered, i.e., there is ORDER BY clause at the end of the view. Different users may want to see the rows in different order. Thus, the DBMS may have to do extra and unnecessary work by firstly sorting based on one set of rows and after that based on other set of rows. Use sorting if you know that all the users want the rows in the same order and cannot/will not change the order in the application.

General License: MIT (opens in new tab)

#315. Perhaps searching based on a name instead of a code

INFORMATION_SCHEMA+system catalog base tables

Find derived tables with a search condition that is possible based on a name instead of a code.

Problem detection License: MIT (opens in new tab)

#316. Deterministic (immutable) functions that do not have input parameters

INFORMATION_SCHEMA+system catalog base tables

Find deterministic functions that do not have any input parameters. Make sure that it is correct because in general a deterministic function must calculate a value based on input.

Problem detection License: MIT (opens in new tab)

#317. Deterministic (immutable) functions that do not return a value

INFORMATION_SCHEMA+system catalog base tables

Find deterministic (immutable) functions that do not return a value. This goes against the idea of deterministic functions.

Problem detection License: MIT (opens in new tab)

#318. Different tasks of rules

system catalog base tables only

Find different tasks that are solved by using rules, i.e., different rules on the same table or different tables that do the same thing are considered to solve one task.

General License: MIT (opens in new tab)

#319. Different tasks of triggers

INFORMATION_SCHEMA+system catalog base tables

Find different tasks that are solved by using triggers, i.e., different triggers on the same table or different tables that do the same thing are considered to solve one task.

General License: MIT (opens in new tab)

#320. Domain CHECK constraints with the same name

INFORMATION_SCHEMA only

Find domain check constraint names that are used more than once (within the same schema or in different schemas). Different things should have different names. However, here different constraints have the same name. Also make sure that this is not a sign of duplication of domains.

Problem detection License: MIT (opens in new tab)
# Name(activate to sort ascending) Goal(sorted ascending, activate to sort descending) Type(activate to sort ascending) Data source(activate to sort ascending) Last update(activate to sort ascending) License Actions
301 Declaratively partitioned tables without partitions Find declaratively partitioned tables that do not have any partitions. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
302 Declaratively partitioned tables with one partition Find declaratively partitioned tables that have exactly one partition. Declarative partitioning is implemented in PostgreSQL starting from PostgreSQL 10. If there is only one partition, then it raises question as to why the additional complexity associated with partitioning is needed. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
303 Do you really need fractional seconds? Find default values that return current timestamp with the maximum number of fractional seconds (6). Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)
304 Deferrable foreign key constraint with a RESTRICT compensating action Find deferrable foreign key constraint with ON UPDATE RESTRICT or ON DELETE RESTRICT compensating action. Referential actions are carried out before, and are not part of, the checking of a referential constraint. Deferring a referential constraint defers the checking of the of the constraint (a ) but does not defer the referential actions of the referential constraint. In PostgreSQL the essential difference between NO ACTION and RESTRICT is that NO ACTION allows the check to be deferred until later in the transaction, whereas RESTRICT does not. Thus RESTRICT could result with the failure of data modification where in case of NO ACTION the modification would succeed. Problem detection system catalog base tables only MIT (opens in new tab) View (opens in new tab)
305 Invocation of PL/pgSQL functions from the subqueries of derived tables Find derived tables that subqueries invoke a PL/pgSQL function. Avoid context switch that is caused by the invocation of PL/pgSQL functions from the subqueries of derived tables. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
306 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 MIT (opens in new tab) View (opens in new tab)
307 Duplicate removal of duplicates in derived tables Find derived tables (views and materialized views) that contain both DISTINCT and GROUP BY. Make sure that the means for removing duplicate rows from the query result are not duplicated. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
308 Derived tables with multiple DISTINCT's Find derived tables (views and materialized views) that contain more than one DISTINCT invocation. Make sure that the query is correctly written, including that it does not have unwanted formation of a Cartesian product. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
309 Derived table presents the same data in the same way as a single base table Find derived tables (views and materialized views) that present data from one base table without adding columns, renaming columns, changing the order of columns, removing columns, or restricting rows. Perhaps something is missing from the subquery of the derived table. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
310 Sorting rows based on random values in derived tables without limiting rows Find derived tables (views and materialized views) that sort rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
311 Sorting rows based on random values in derived tables Find derived tables (views and materialized views) that sort rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
312 Set operations that do not remove duplicate rows in derived tables Find derived tables (views and materialized views) that use a set theoretic operation (union, except or intersect) in a manner that does not remove duplicate rows and thus can produce a multiset not a set. Make sure that it is what is needed. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
313 Too wide derived (dependent) table Find derived tables (views, materialized views) that are based on more than five tables and that have more than 15 columns. This view might produce "a denormalized world view" where all the data is together in one table and applications make queries based on this single view to fulfill their specific tasks. Such view does not follow the separation of concerns principle. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
314 Derived tables with sorting Find derived tables where the rows are ordered, i.e., there is ORDER BY clause at the end of the view. Different users may want to see the rows in different order. Thus, the DBMS may have to do extra and unnecessary work by firstly sorting based on one set of rows and after that based on other set of rows. Use sorting if you know that all the users want the rows in the same order and cannot/will not change the order in the application. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
315 Perhaps searching based on a name instead of a code Find derived tables with a search condition that is possible based on a name instead of a code. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
316 Deterministic (immutable) functions that do not have input parameters Find deterministic functions that do not have any input parameters. Make sure that it is correct because in general a deterministic function must calculate a value based on input. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
317 Deterministic (immutable) functions that do not return a value Find deterministic (immutable) functions that do not return a value. This goes against the idea of deterministic functions. Problem detection INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
318 Different tasks of rules Find different tasks that are solved by using rules, i.e., different rules on the same table or different tables that do the same thing are considered to solve one task. General system catalog base tables only MIT (opens in new tab) View (opens in new tab)
319 Different tasks of triggers Find different tasks that are solved by using triggers, i.e., different triggers on the same table or different tables that do the same thing are considered to solve one task. General INFORMATION_SCHEMA+system catalog base tables MIT (opens in new tab) View (opens in new tab)
320 Domain CHECK constraints with the same name Find domain check constraint names that are used more than once (within the same schema or in different schemas). Different things should have different names. However, here different constraints have the same name. Also make sure that this is not a sign of duplication of domains. Problem detection INFORMATION_SCHEMA only MIT (opens in new tab) View (opens in new tab)