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...
761Stating the obvious (2)Find the names of database objects where the name of the database object contains a part of the name of the object type. For instance, the query finds base tables, were the name contains fragments _base, base_, _table, or table_.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-26 17:04MIT License
762Stating the obvious (column names)Find the names of columns where the name of the column contains a part of the name of the data type of the column. For instance, the query finds columns, were the name contains fragments integer_ or _integer.Problem detectionINFORMATION_SCHEMA only2023-11-04 15:19MIT License
763Subqueries of derived tables with LIMIT/FETCH/DISTINCT ON without ORDER BYFind subqueries of derived tables (views, materialized views) with the LIMIT/FETCH clause or with DISTINCT ON construct but without the ORDER BY clause. These constructs require sorting to produce a meaningful result.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-03 16:56MIT License
764Surrogate key columns that do not follow the naming styleFind surrogate key columns that name does not end with "id_" or start with "id_".Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-16 12:19MIT License
765System-generated domain CHECK constraint namesFind the names of domain CHECK constraints that have been system-generated. Names should follow the same style. If there is a mix of system-generated and user-defined names, then the style is most probably different.Problem detectionINFORMATION_SCHEMA only2022-10-27 15:44MIT License
766System-generated table constraint names (constraints that involve one column)Find the names of database constraints that have been system-generated. Additional restrictions are that the constraints must involve only one column and are associated directly with a table (not through a domain). Names should follow the same style. If there is a mix of system-generated and user-defined names, then the style is most probably different.Problem detectionsystem catalog base tables only2021-12-10 12:47MIT License
767Table columns with NOT VALID CHECK constraintsFind CHECK constraints of base table and foreign table columns that are not valid. These constraints have been created so that the existing data has not been checked against the constraint. It could be deliberate in case of legacy systems that have data quality problems. However, ideally all the data in the table conforms to the constraint.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
768Table constraints with the same name (constraints connected directly with a base table or a foreign table)Find base table and foreign table constraint names that are used in a database more than once (possibly in different schemas or in case of different types of constraints). Different things should have different names. But here different constraints have the same name. Also make sure that this is not a sign of duplication.Problem detectionsystem catalog base tables only2022-11-15 16:43MIT License
769Table functions with OFFSETFind table functions that use OFFSET. OFFSET method is a common way for implementing pagination.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-09 12:13MIT License
770Table privileges have been granted to PUBLICYou should follow the principle of least privilege and thus not have in your database tables that usage privileges are granted to the pseudo-role PUBLIC, i.e., to all the database users now and in the future.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
771Table, routine, and usage privileges that have been granted to a superuserFind table, routine, and usage privileges 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 detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
772Tables without columnsDo not have in a database elements that are not useful. PostgreSQL permits tables with no columns. Such tables can be used to implement Boolean variables (tables TABLE_DEE and TABLE_DUM). On the other hand, such tables might be a result of database evolution, where developers have not noticed that they have dropped all the columns of a table or have not noticed that they have created such a table in the first place.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
773Temporal function in a simple check constraint is inconsistent with the column typeFind base table columns with a check constraint that refers to a temporal function (current_timestamp, localtimestamp, current_date, or now) that return type is inconsistent with the data type of the column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-08 21:43MIT License
774Textual columns that have a secondary index but the operator class for the column does not support pattern matchingFind indexed textual columns where the indexing does not consider the possibility of pattern-based search. Such columns do not have an index where the used operator class makes the index suitable for use by queries involving pattern matching expressions.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-07 11:52MIT License
775TG_ARGV is missingWrite correct code. If you pass arguments to a trigger function, then the function should use the arguments. TG_ARGV[]: "Data type array of text; the arguments from the CREATE TRIGGER statement. The index counts from 0. Invalid indexes (less than 0 or greater than or equal to tg_nargs) result in a null value." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:30MIT License
776The expression of a check constraint that is associated with a domain needs type conversionFind check constraints of domains where the Boolean expression invokes an operation that does not match with the data type of the domain.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
777The expression of a simple check constraint that is associated directly with a column needs type conversionFind check constraints that involve one column and are associated directly with a table where the Boolean expression invokes an operation that does not match with the data type of the column.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License
778The generator of surrogate key values can output the same value more than onceFind surrogate keys where the generator can output the same value more than once. Key values must be unique, i.e., at some point the generator will prevent adding new rows to the table.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-03-08 00:40MIT License
779The generic names (columns) (aggregate view)Find the too generic column names and the number of their occurrences.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-01-15 10:34MIT License
780The maximum number of characters may be missingPerhaps the character maximum length has been omitted accidentally, i.e., one wrote VARCHAR instead of VARCHAR(n) where n is the maximum permitted number of characters in the field value. VARCHAR and TEXT are synonyms.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License