Filter Queries
Found 1053 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.
#681. User-defined derived tables
INFORMATION_SCHEMA+system catalog base tablesFind user-defined views and materialized views. Pay attention to the outer join operations. One should use these if and only if there is a real need for them. Otherwise they just reduce performance. On the other hand, pay attention that outer join is used where it is logically needed.
#682. User-defined routines that implement UPSERT operation
INFORMATION_SCHEMA+system catalog base tablesFind user-defioned routines that implement UPSERT operation. Make sure that it is consistent with the contracts of database operations.
#683. User-defined routines that produce a temporary table
INFORMATION_SCHEMA+system catalog base tablesFind user user-defined routines that produce a temporary table
#684. Derived tables that present data in json or xml format
INFORMATION_SCHEMA+system catalog base tablesFind views and materialized views that present data in json or xml format. Instead of recording data in this format in base tables one could generate the data value on the fly based on data that has been recorded in base tables.
#685. Derived tables with ranking
INFORMATION_SCHEMA+system catalog base tablesFind views and materialized views that use rank and dense_rank window functions.
#686. Derived tables with string_agg
INFORMATION_SCHEMA+system catalog base tablesFind views and materialized views that use string_agg aggregate function.
#687. Too short or missing comments of derived tables and routines
INFORMATION_SCHEMA+system catalog base tablesFind views, materialized views, and user-defined routines that do not have a comment at all or the comment is shorter than twice the length of the object name, or the comment states that it is missing (TODO). You should give information to future developers and maintainers of the system (including the future version of yourself). Do not just repeat the name in the comment (with perhaps some rewording).
#688. Views without security barrier
INFORMATION_SCHEMA+system catalog base tablesFind views that do not have the security barrier option.
#689. Views with WHERE but without security barrier
INFORMATION_SCHEMA+system catalog base tablesFind views that do not have the security barrier option but restrict rows in some way.
#690. Views with security invoker
system catalog base tables onlyFind views that have the security invoker option. Such option is possible starting from PostgreSQL 15. In case of using such views one cannot create a system where data is accessed through views and the users (applications) do not have direct access to the base tables.
#691. Derived table uses a function to get data from another table
INFORMATION_SCHEMA+system catalog base tablesFind views that use a function to get data from another table.
#692. Duplicate views
INFORMATION_SCHEMA onlyFind views with exactly the same subquery. There should not be multiple views with exactly the same subquery. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication.
#693. Views with unnecessary security invoker
INFORMATION_SCHEMA+system catalog base tablesFind views with security invoker option that do not have any underlying base table with a security policy. Security invoker option of views is possible starting from PostgreSQL 15. "The main use case (and the one that inspired the feature) is to be able to use views and still check row-level security policies on the underlying tables as the invoker."
#694. 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.
#695. The same database object name is used repeatedly in case the same database object type
INFORMATION_SCHEMA+system catalog base tablesFind what database object names are used more than once in case the objects of the same type. If the names differ from each other only by digits or underscores, then consider these the same name. For instance, if there are base tables Person and Person2 (in the same schema or different schemas), then the query returns the name Person. Make sure that there is no duplication of implementation elements in the database.
#696. Do not always depend on one's parent
system catalog base tables onlyFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table.
#697. Do not always depend on one's parent - column names are ot sufficiently different
system catalog base tables onlyFind where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four).
#698. Do not always depend on one's parent (INFORMATION_SCHEMA)
INFORMATION_SCHEMA onlyFind where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list.
#699. Inconsistent data type usage in case of registering a symbol
INFORMATION_SCHEMA onlyFind whether the database uses both CHAR(1) and VARCHAR(1) columns to register a single symbol.
#700. Double negatives in regular expressions
INFORMATION_SCHEMA+system catalog base tablesFing regular expression patterns that use [^\S] instead of \s or [^\D] instead of \d or [^\W] instead of \w.
| # | Name | Goal (sorted ascending) | Type | Data source | Last update | License | Actions |
|---|---|---|---|---|---|---|---|
| 681 | User-defined derived tables | Find user-defined views and materialized views. Pay attention to the outer join operations. One should use these if and only if there is a real need for them. Otherwise they just reduce performance. On the other hand, pay attention that outer join is used where it is logically needed. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 682 | User-defined routines that implement UPSERT operation | Find user-defioned routines that implement UPSERT operation. Make sure that it is consistent with the contracts of database operations. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 683 | User-defined routines that produce a temporary table | Find user user-defined routines that produce a temporary table | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 684 | Derived tables that present data in json or xml format | Find views and materialized views that present data in json or xml format. Instead of recording data in this format in base tables one could generate the data value on the fly based on data that has been recorded in base tables. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 685 | Derived tables with ranking | Find views and materialized views that use rank and dense_rank window functions. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 686 | Derived tables with string_agg | Find views and materialized views that use string_agg aggregate function. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 687 | Too short or missing comments of derived tables and routines | Find views, materialized views, and user-defined routines that do not have a comment at all or the comment is shorter than twice the length of the object name, or the comment states that it is missing (TODO). You should give information to future developers and maintainers of the system (including the future version of yourself). Do not just repeat the name in the comment (with perhaps some rewording). | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 688 | Views without security barrier | Find views that do not have the security barrier option. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 689 | Views with WHERE but without security barrier | Find views that do not have the security barrier option but restrict rows in some way. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 690 | Views with security invoker | Find views that have the security invoker option. Such option is possible starting from PostgreSQL 15. In case of using such views one cannot create a system where data is accessed through views and the users (applications) do not have direct access to the base tables. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 691 | Derived table uses a function to get data from another table | Find views that use a function to get data from another table. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 692 | Duplicate views | Find views with exactly the same subquery. There should not be multiple views with exactly the same subquery. Do remember that the same task can be solved in SQL usually in multiple different ways. Thus, the exact copies are not the only possible duplication. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 693 | Views with unnecessary security invoker | Find views with security invoker option that do not have any underlying base table with a security policy. Security invoker option of views is possible starting from PostgreSQL 15. "The main use case (and the one that inspired the feature) is to be able to use views and still check row-level security policies on the underlying tables as the invoker." | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 694 | 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 (opens in new tab) | |
| 695 | The same database object name is used repeatedly in case the same database object type | Find what database object names are used more than once in case the objects of the same type. If the names differ from each other only by digits or underscores, then consider these the same name. For instance, if there are base tables Person and Person2 (in the same schema or different schemas), then the query returns the name Person. Make sure that there is no duplication of implementation elements in the database. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 696 | Do not always depend on one's parent | Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. | General | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 697 | Do not always depend on one's parent - column names are ot sufficiently different | Find where a hierarchical structure is implemented in a base table by adding a foreign key that refers to a candidate key of the same table. Find only cases where the candidate key and foreign key column names are very similar (Levenshtein distance shorter than four). | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 698 | Do not always depend on one's parent (INFORMATION_SCHEMA) | Find where a hierarchical structure is implemented in a base table by having a foreign key that refers to a candidate key of the same table. This design is called adjacency list. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 699 | 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) | |
| 700 | Double negatives in regular expressions | Fing regular expression patterns that use [^\S] instead of \s or [^\D] instead of \d or [^\W] instead of \w. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) |