Catalog of PostgreSQL queries for finding information about a PostgreSQL database and its design problems

AND
AND
AND
ANDFrom where does the query gets its information?
AND
AND

There are 961 queries.

Seq nrNameGoalTypeData sourceLast updateLicense...
441Grantable rolesFind roles that a member can grant to others, i.e., the role has been granted with ADMIN OPTION. The number of privileges that can be passed on should be as small as possible.Problem detectionsystem catalog base tables only2024-01-07 13:42MIT License
442Grantable routine privilegesFind routine privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-07 13:43MIT License
443Grantable table privilegesFind table privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-07 13:43MIT License
444Grantable usage privilegesFind usage privileges that the carrier of the privilege can in turn grant to others, i.e., the privileges have been given WITH GRANT OPTION. The number of privileges that can be passed on should be as small as possible.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-07 13:43MIT License
445Gratuitous context in the names of foreign key columnsFind foreign key columns that name contains twice the name of the referenced (primary) table.Problem detectionsystem catalog base tables only2021-02-25 17:29MIT License
446Gratuitous context in the names of non-foreign key and non-candidate key columnsFind the names on base table columns that are not a part of a candidate key and a foreign key and that contain the name of the table. Exclude very general column names (for instance, nimi, nimetus, kommentaar, kirjeldus, name, comment, description). In case of these using the table name in the column name is not a problem because it simplifies writing the queries based on the tables. In this case one does not have to rename the columns in the query result.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-15 13:39MIT License
447Gratuitous context in the names of parametersFind routine parameter names that contain the routine name. Names of routine parameters shouldn't contain the name of the routine. It makes the names too long. A routine cannot have two parameters with the same name.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
448Gratuitous context in the names of schema objectsFind schema objects that name starts with the schema name and then has at least one more symbol. "Shorter names are generally better than longer ones, so long as they are clear. Add no more context to a name than is necessary" (Robert C. Martin, Clean Code) Shema is a namespace. There cannot be in the same schema two schema objects that belong to the same name class and have the same name.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
449Identical indexesFind indexes that are identical, i.e., have the same properties, including uniqueness. The query considers all types of indexes, including indexes that have been automatically created to support a constraint and function-based indexes.Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
450Identifiers that explicitly say that they carry no meaningFind identifiers that explicitly say that they carry no meaning. Such identifier is called "unnamed" or "anonymous".Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 11:06MIT License
451Inappropriate field size or data type for column that strores database usernameFind columns of base tables that based on the default value of the column contain database username. However, the type of the column is not VARCHAR(63) or VARCHAR(128).Problem detectionINFORMATION_SCHEMA only2023-11-19 11:58MIT License
452Inconsistency between the name and the type of a base table column (dates)Find base table columns that name refers to the possibility that these are used to register dates. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column data type is "date", then the suffix of the column name should be "kp" (Estonian) or "date" (English).Problem detectionINFORMATION_SCHEMA only2021-03-27 16:16MIT License
453Inconsistency between the name and the type of a base table column (timestamps)Find base table columns that name refers to the possibility that these are used to register timestamps. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column type is "timestamp", then the suffix of the column name should be "aeg" (Estonian) or "time" (English).Problem detectionINFORMATION_SCHEMA only2021-03-28 15:12MIT License
454Inconsistency between the type and the default value of a column (date and timestamp values)Find table columns with timestamp/date types that data type and dynamically found default value have a different type.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
455Inconsistency between the type and the default value of a column (time values)Find table columns with time types, which data type and dynamically found default value have a different type.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
456Inconsistency (code vs. id) of naming foreign key and referenced candidate key columnsNaming of foreign key and referenced candidate key columns should be consistent. It cannot be so that in one table a value is labeled "id" like some surrogate key value and in another it "turns" into human-usable "code" or vice versa. An example:

Person(person_id, name)
Primary Key (person_id)

E_mail_address(e_mail_address_id, person_code, address)
Primary Key (e_mail_address_id)
Foreign key (person_code) References Person (person_id)
Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
457Inconsistency of using column data types/field sizes in case of columns that implement relationshipsFind foreign key constraints where the candidate key columns (belong to a PRIMARY KEY/UNIQUE constraint) and foreign key columns do not have the same data type and field size. Primary key/unique columns and foreign key columns should have the same data type and field size. If, for instance, the primary key column has type INTEGER and foreign key column has type SMALLINT, then one cannot use all the primary key values as foreign key values.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-10 12:13MIT License
458Inconsistency of using parameter data typesFind parameters of routines that have the same name but a different type. Parameters that have the same name should have, in general, the same data type as well, assuming that the routines, which have the parameters, have different names, i.e., there is no overloading in play.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
459Inconsistent chain of relationships in terms of using ON UPDATE CASCADEIn case of a chain of relationships between tables (where the primary key and the foreign key have the same columns) the use of ON UPDATE CASCADE should be consistent - either all the involved foreign keys have ON UPDATE CASCADE compensating action or none of these have it. For instance, in the next example there is inconsistency, because if one changes the person_code in table Person, then the modification does not succeed because it does not cascade to the table Product. It is unclear as to whether it should be possible to change the person_code or not.

Person (person_code, surname)
Primary key (person_code)

Worker(person_code)
Primary key (person_code)
Foreign key (person_code) References Person (person_code) ON UPDATE CASCADE

Product(product_code, registrator)
Primary key (product_code)
Foreign key (registrator) References Worker (person_code) ON UPDATE NO ACTION
Problem detectionsystem catalog base tables only2021-02-25 17:30MIT License
460Inconsistent data type usage in case of registering a dateFind as to whether there are multiple different types used in case of columns that are meant for registering dates.Problem detectionINFORMATION_SCHEMA only2021-03-21 18:32MIT License