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...
861Using in some way reserved (in PostgreSQL) SQL keywords as the names of a database object (detailed view)"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should not cause confusion. Find the names (identifiers) of user-defined objects that are SQL keywords that are not completely unreserved in PostgreSQL, i.e., these either never cannot be used as regular identifiers or cannot be used in case of some type of database objects. In PostgreSQL "there are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. " (PostgreSQL manual) Moreover, such identifiers are often too general, i.e., do not provide enough information about the named object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-18 16:39MIT License
862Using routine name in front of a parameter name in a routine body to refer to the parameter of the routineWrite code that is easy to understand and not unnecessarily long. A routine cannot have two or more parameters with the same name. In this case using longer identifier in the form routine_name.parameter name is unnecessary.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-05 13:40MIT License
863Using system-defined names of constraints (constraints that involve more than one column)Find the constraint types in case of which there exists system-defined names.Problem detectionsystem catalog base tables only2023-01-10 14:53MIT License
864Using system-defined names of constraints (constraints that involve one column)Find the constraint types in case of which there exists system-defined names.Problem detectionsystem catalog base tables only2023-01-10 14:53MIT License
865Using unreserved (in PostgreSQL) SQL keywords as the names of a database object (aggregate view)"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should not cause confusion. Find the distinct names (identifiers) of user-defined objects that are SQL keywords that are completely unreserved in PostgreSQL. In PostgreSQL "there are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. " (PostgreSQL manual) Although the names are unreserved keywords in PostgreSQL these could be reserved keywords in other systems, which would complicate database migration. Moreover, such identifiers are often too general, i.e., do not provide enough information about the named object.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 11:18MIT License
866Using unreserved (in PostgreSQL) SQL keywords as the names of a database object (detailed view)"Names in software are 90 percent of what make software readable. You need to take the time to choose them wisely and keep them relevant. Names are too important to treat carelessly. Names should not cause confusion." (Robert C. Martin, Clean Code) Names should not cause confusion. Find the names (identifiers) of user-defined objects that are SQL keywords that are completely unreserved in PostgreSQL. In PostgreSQL "there are several different classes of tokens ranging from those that can never be used as an identifier to those that have absolutely no special status in the parser as compared to an ordinary identifier. " (PostgreSQL manual) Although the names are unreserved keywords in PostgreSQL these could be reserved keywords in other systems, which would complicate database migration. Moreover, such identifiers are often too general, i.e., do not provide enough information about the named object. Think as to whether some better name would be possible.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 11:20MIT License
867Validation method does not confirmFind user-defined SQL and PL/pgSQL routines that do not return a value although the name suggest that it should return a value (starts with "validate" or "check").Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-06 14:25MIT License
868Very similar column namesFind the pairs of table columns that name is different only by one symbol and that have the same type and/or domain.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-18 20:25MIT License
869Views without security barrierFind views that do not have the security barrier option.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-22 12:05MIT License
870Views with security invokerFind 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 detectionsystem catalog base tables only2023-11-13 12:20MIT License
871Views with the WITH LOCAL CHECK OPTION constraintFind updatable views that have WITH LOCAL CHECK OPTION constraint. The predicate of a view is the conjunction of the predicates of its (directly and indirectly) underlying tables (both base tables and derived tables) as well as the predicate of the view itself. In case of using WITH LOCAL CHECK OPTION constraint "New rows are only checked against the conditions defined directly in the view itself. Any conditions defined on underlying base views are not checked (unless they also specify the CHECK OPTION)." (PostgreSQL manual) Thus, use instead WITH CASCADED CHECK option to instruct the system to check new rows against the entire predicate of the view.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
872Views with unnecessary security invokerFind 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 detectionINFORMATION_SCHEMA+system catalog base tables2023-11-17 18:39MIT License
873Views with WHERE but without security barrierFind views that do not have the security barrier option but restrict rows in some way.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-14 12:58MIT License
874Wrong comment - trigger function does not implement a database operationTrigger functions should not contain references to database operations. Perhaps the trigger implements ensuring some invariant of the operation but it does not implement the operation itself.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
875YELLING IN COMMENTS!Find comments of derived tables and routines that consist of only uppercase letters. Do not use only uppercase (capital) letters in order to write comments. It means yelling and also makes text less readable.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-04-25 15:13MIT License
876All supertablesFind all the base tables that serve as supertables in the inheritance hierarchiesSofware measuresystem catalog base tables only2021-03-14 17:07MIT License
877Check as to wheteher the names of columns are in the plural or in the singular form (English version) (aggregate view)Check as to wheteher the names of table columns are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of columns that name is in plural or in singular by table type.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-03-20 13:19MIT License
878Check as to wheteher the names of tables are in the plural or in the singular form (English version) (aggregate view)Check as to wheteher the names of tables are in the plural or in the singular form. Make sure that you are consistent in naming. Show the number of tables that name is in plural or in singular by table type.Sofware measureINFORMATION_SCHEMA+system catalog base tables2023-01-16 01:09MIT License
879Consistency of using NOT NULL constraints on Boolean base table columnsFind the number of mandatory and optional Boolean base table columns and the proportion of optional columns from all the Boolean columns. Use two-valued logic (TRUE, FALSE) instead of three-valued logic (TRUE, FALSE, UNKNOWN). Because NULL in a Boolean column means unknown make all the Boolean columns mandatory.Sofware measureINFORMATION_SCHEMA only2020-12-28 01:43MIT License
880Depth of referential tree of a schemaDepth of referential tree of a database schema is the longest referential path between the tables in this schema (Piattini et al., 2001). In other words, it is the biggest value among the DRT(T) values of all the tables of the schema.Sofware measuresystem catalog base tables only2020-11-14 15:28MIT License