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...
781The name of the base table that implements a binary relationship type does not explain the meaning of the relationshipFind base tables that implement a binary relationship type (have two foreign keys) and the name of the table consist of the names of tables that this (intermediate) table connect. The names should be derived from the domain. For instance, instead of name Course_Lecturer it is better to have name Teaching.Problem detectionsystem catalog base tables only2023-03-18 17:58MIT License
782The name of the routine does not match with the action of the routineFind user-defined non-trigger SQL and PL/pgSQL routines where the beginning of the name of the routine indicates a certain action inside the routine (INSERT, UPDATE, or DELETE) but there is no such statement in the routine body.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-19 14:37MIT License
783The reference to a database operation is missing from a commentFind user-defined routines that comment does not contain a reference to a database operation that the routine implements. In case of routines that have been created based on the contracts of database operations, one should refer to the short identifier of the operation in the comment of the routine. The operation identifier must be in this case in the form OP, but other forms could be used as well.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:39MIT License
784There is no reason to use PL/pgSQL if you do not use one or more features of a procedural languageUsing PL/pgSQL may cause context switching between declarative SQL and procedural PL/pgSQL. Thus use PL/pgSQL only if you truly need some of its constructs (variables, conditional statements, cycles, cursors, exception handling).Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 16:32MIT License
785There is no reason to use PL/pgSQL to write table functionsUsing PL/pgSQL may cause context switching between declarative SQL and procedural PL/pgSQL. Thus use PL/pgSQL only if you truly need some of its constructs. You can create table functions by using SQL.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-11-04 11:28MIT License
786The same CHECK has a different name in different placesFind the names of table CHECK constraints that have the same Boolean expression but a different naming style in different places (tables). The naming of constraints should be consistent. "If you do something a certain way, do all similar things in the same way." (Robert C. Martin, Clean Code)Problem detectionsystem catalog base tables only2023-01-14 20:47MIT License
787The same name is used in different contexstsFind the names that are used in case of different types of elementsProblem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-17 10:33MIT License
788The same sequence generator is used in case of multiple columnsDo not cause a potential performance bottleneck by having a shared resource. By having a shared sequence it is not possible to change properties of sequences of different tables independently (for instance the owner column or step), i.e., it increases coupling between tables. By having a shared sequence it is impossible to specify the owner (table column) to the sequence generator.Problem detectionINFORMATION_SCHEMA only2021-03-07 21:07MIT License
789The SQL-language routines with the body that is string literalFind SQL-language routines that have the body that is string literal, i.e., the body is not SQL-standard function body. Routines with a SQL-standard body are permitted starting from PostgreSQL 14.Problem detectionINFORMATION_SCHEMA+system catalog base tables2024-01-24 18:20MIT License
790Three-valued logic (Boolean columns)Find base table columns that have Boolean type and do not have NOT NULL constraint. 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.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
791Three-valued logic (non-Boolean columns)Find non-foreign key columns of base tables that probably (based on the column name) contain values that represent truth values but do not have NOT NULL constraint. 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 columns mandatory.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-20 14:07MIT License
792Too few rounds in case of calculating the hashFind user-defined routines where gen_salt function is used with the number of rounds that is smaller than 12. The number should be adjusted based on the hardware where the system resides. Password hashing should take at least 250 ms.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 17:21MIT License
793Too generic names (candidate key columns)Find candidate key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix. These are too generic names.Problem detectionsystem catalog base tables only2023-01-20 12:35MIT License
794Too generic names (columns)Find the names of columns that are too generic. In SQL databases data/information is represented as values in columns. It is not a good style to use generic words like data, information, column, etc. In the names of columns. Moreover, avoid too generic column names like: id, tyyp, kood, aeg, kp,type, code, time, date, fk, pk.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-15 10:33MIT License
795Too generic names (columns) (there is a column with a more specific name in the table)Find column names in case of which the same table has another column (with more specific name) that name contains the column name in the end or in the beginning. For instance, a base table has columns parent and root_parent and the former col-umn name is too generic, i.e., it should be more specific.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-03-20 01:01MIT License
796Too generic names (domain constraints)Find domain CHECK constraints that have a too generic name - for instance, the name contains word "data" ) or the name is an abbreviation of the constraint type name (for instance, "chk" or "chk1").Problem detectionINFORMATION_SCHEMA only2021-10-31 17:39MIT License
797Too generic names (foreign key columns)Find foreign key columns with the names like id, identifikaator, code, kood, number, etc. The names should have a prefix or a suffix that describes the nature of relationship with the referenced table or at least referes to the referenced table. These are too generic names.Problem detectionsystem catalog base tables only2023-01-20 12:37MIT License
798Too generic names (parameters)Find the names of parameters that are too generic. The routines work with data/information. Thus, it is not a good style to use generic words like data, information, parameter, etc. In the names of parameters. Moreover, avoid too generic parameter names like: id, tyyp, kood, aeg, kp,type, code, time, date, fk, pk, param.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-20 14:08MIT License
799Too generic names (parameters) (there is a parameter with a more specific name in the routine)Find parameter names in case of which the same routine has another parameter with the same mode but with more specific name, i.e., the name contains the parameter name in the end or in the beginning.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-12-06 12:03MIT License
800Too generic names regarding persons and their names (columns of derived tables)Find derived table columns that name refers to the possibility that these contain person names. The names of derived table columns that contain person names should refer to the role that the corresponding entity type has in the view. For instance, if view active_product has a column with the name surname, then the column name does not give information what is the role of the person in the context of the view. Better name would be, for instance, registrator_surname.Problem detectionINFORMATION_SCHEMA+system catalog base tables2022-11-10 14:25MIT License