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.
#801. Prefixes of base table names
INFORMATION_SCHEMA onlyFind base tables that name starts with a prefix. Do not use prefixes in case of base table names. Derive the names from the names of entity types. Do not use "_", "t_", "tab_", "t11_" etc as prefixes of a table.
#802. Preventing strings that consist of only spaces instead of strings that consist of only whitespace characters
INFORMATION_SCHEMA onlyFind columns of base tables and foreign tables where one uses a check constraint to prevent values that consist of only spaces. Make sure that this is the correct constraint and there is no need to prevent values that consist of only whitespace characters.
#803. Primary key columns are not the first in a table
INFORMATION_SCHEMA+system catalog base tablesIn SQL tables each column has the ordinal position. Find all the base tables where the primary key columns are not the first in the table, i.e., there is at least one non-primary key column that comes before a primary key column. It is easier to grasp the primary key if its columns are the first in the table. It could be that a table inherits from an abstract table where no keys have been defined.
#804. Privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign servers that have been granted to a superuser
system catalog base tables onlyFind privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign servers that have been granted to a superuser. Superuser can do anything in the database and thus does not need the privileges. The result is a sign that perhaps the executed GRANT statements were incorrect (wrong username) or the grantee later got superuser status (that it shouldn't have).
#805. Privileges to execute routines
INFORMATION_SCHEMA+system catalog base tablesFind privileges to execute routines that have been given to non-superusers. Check as to whether it conforms to the principle of least privilege. Check that users that correspond to applications have all the necessary privileges. Users (applications) should use a database through virtual data layer. Thus, if they need to modify data in the database (in case of table functions read data), then they must execute a routine.
#806. Privileges to use base table columns
INFORMATION_SCHEMA+system catalog base tablesIf you do give privileges to base tables, then these should follow the principle of least privilege - the smallest possible amount of privileges to the smallest possible set of columns
#807. Privileges to use base tables
INFORMATION_SCHEMA+system catalog base tablesUsers (applications) should ideally use a database through virtual data layer and thus not directly use base tables. If there is a need to provide direct access to the base tables, then one should grant access based on the principle of least privilege, i.e., to the minimum possible number of base tables.
#808. Privileges to use views
INFORMATION_SCHEMA+system catalog base tablesFind privileges to use views. Check as to whether it conforms to the principle of least privilege. Check that users that correspond to applications have all the necessary privileges. Users (applications) should use a database through virtual data layer. Thus, if they need to read data from a database, then they should use views.
#809. Procedures cannot have START TRANSACTION and SAVEPOINT
INFORMATION_SCHEMA+system catalog base tablesYou cannot use a START TRANSACTION or a SAVEPOINT statement in a procedure. Procedures appeared in PostgreSQL 11.
#810. Publications with no tables
system catalog base tables onlyFind publications that do not contain any table.
#811. PUBLIC has TEMPORARY privilege in the database
system catalog base tables onlyFind as to whether PUBLIC (all current and future users) has TEMPORARY privilege in the database. PUBLIC gets the privilege by default.
#812. PUBLIC has the USAGE privilege of a schema
INFORMATION_SCHEMA+system catalog base tablesFind schemas where PUBLIC has the usage privilege.
#813. Publicly accessible system catalog tables
INFORMATION_SCHEMA onlyFind privileges to use system catalog base tables or views that have been granted to public.
#814. Recursive relationships with the same source and target
system catalog base tables onlyFind incorrectly implemented adjacency lists.
#815. Recursive rules that directly modify their home table
system catalog base tables onlyDo not cause potentially infinite loops. Recursive rules would fire itself over and over again. Although the system is able to detect these after executing a data modification statement it is better to avoid creating these altogether.
#816. Redundant indexes
system catalog base tables onlyFind indexes that may be redundant. In addition to identical indexes it also considers indexes that cover the same columns and have the same properties except uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes.
#817. Reference to the numeric type is too imprecise, i.e., precision and scale are missing
INFORMATION_SCHEMA onlyFind base table columns that have the DECIMAL/NUMERIC type, but do not have precision and scale specified. "Specifying: NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale."
#818. Referential degree of a schema
INFORMATION_SCHEMA onlyReferential degree of a schema is defined as the number of foreign keys in the database schema.
#819. Referential degree of tables
INFORMATION_SCHEMA onlyThis metric represents the number of foreign keys in a base table.
#820. Referential degree of tables (ver 2)
system catalog base tables onlyFind how many base tables are referenced from a base table by using foreign keys.
| # | Name(activate to sort ascending) | Goal(activate to sort ascending) | Type(activate to sort ascending) | Data source(activate to sort ascending) | Last update(sorted descending, activate to sort ascending) | License | Actions |
|---|---|---|---|---|---|---|---|
| 801 | Prefixes of base table names | Find base tables that name starts with a prefix. Do not use prefixes in case of base table names. Derive the names from the names of entity types. Do not use "_", "t_", "tab_", "t11_" etc as prefixes of a table. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 802 | Preventing strings that consist of only spaces instead of strings that consist of only whitespace characters | Find columns of base tables and foreign tables where one uses a check constraint to prevent values that consist of only spaces. Make sure that this is the correct constraint and there is no need to prevent values that consist of only whitespace characters. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 803 | Primary key columns are not the first in a table | In SQL tables each column has the ordinal position. Find all the base tables where the primary key columns are not the first in the table, i.e., there is at least one non-primary key column that comes before a primary key column. It is easier to grasp the primary key if its columns are the first in the table. It could be that a table inherits from an abstract table where no keys have been defined. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 804 | Privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign servers that have been granted to a superuser | Find privileges on the database and its schemas, domains, types, languages, sequences, foreign data wrappers, and foreign servers that have been granted to a superuser. Superuser can do anything in the database and thus does not need the privileges. The result is a sign that perhaps the executed GRANT statements were incorrect (wrong username) or the grantee later got superuser status (that it shouldn't have). | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 805 | Privileges to execute routines | Find privileges to execute routines that have been given to non-superusers. Check as to whether it conforms to the principle of least privilege. Check that users that correspond to applications have all the necessary privileges. Users (applications) should use a database through virtual data layer. Thus, if they need to modify data in the database (in case of table functions read data), then they must execute a routine. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 806 | Privileges to use base table columns | If you do give privileges to base tables, then these should follow the principle of least privilege - the smallest possible amount of privileges to the smallest possible set of columns | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 807 | Privileges to use base tables | Users (applications) should ideally use a database through virtual data layer and thus not directly use base tables. If there is a need to provide direct access to the base tables, then one should grant access based on the principle of least privilege, i.e., to the minimum possible number of base tables. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 808 | Privileges to use views | Find privileges to use views. Check as to whether it conforms to the principle of least privilege. Check that users that correspond to applications have all the necessary privileges. Users (applications) should use a database through virtual data layer. Thus, if they need to read data from a database, then they should use views. | General | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 809 | Procedures cannot have START TRANSACTION and SAVEPOINT | You cannot use a START TRANSACTION or a SAVEPOINT statement in a procedure. Procedures appeared in PostgreSQL 11. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 810 | Publications with no tables | Find publications that do not contain any table. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 811 | PUBLIC has TEMPORARY privilege in the database | Find as to whether PUBLIC (all current and future users) has TEMPORARY privilege in the database. PUBLIC gets the privilege by default. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 812 | PUBLIC has the USAGE privilege of a schema | Find schemas where PUBLIC has the usage privilege. | Problem detection | INFORMATION_SCHEMA+system catalog base tables | MIT (opens in new tab) | View (opens in new tab) | |
| 813 | Publicly accessible system catalog tables | Find privileges to use system catalog base tables or views that have been granted to public. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 814 | Recursive relationships with the same source and target | Find incorrectly implemented adjacency lists. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 815 | Recursive rules that directly modify their home table | Do not cause potentially infinite loops. Recursive rules would fire itself over and over again. Although the system is able to detect these after executing a data modification statement it is better to avoid creating these altogether. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 816 | Redundant indexes | Find indexes that may be redundant. In addition to identical indexes it also considers indexes that cover the same columns and have the same properties except uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes. | Problem detection | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) | |
| 817 | Reference to the numeric type is too imprecise, i.e., precision and scale are missing | Find base table columns that have the DECIMAL/NUMERIC type, but do not have precision and scale specified. "Specifying: NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale." | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 818 | Referential degree of a schema | Referential degree of a schema is defined as the number of foreign keys in the database schema. | Sofware measure | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 819 | Referential degree of tables | This metric represents the number of foreign keys in a base table. | Sofware measure | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 820 | Referential degree of tables (ver 2) | Find how many base tables are referenced from a base table by using foreign keys. | Sofware measure | system catalog base tables only | MIT (opens in new tab) | View (opens in new tab) |