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...
761Storing file content in the databaseFind columns that probably store content of files in the database.GeneralINFORMATION_SCHEMA only2021-03-27 17:02MIT License
762Subqueries 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
763Surrogate key columnsFind surrogate keys. Surrogate key is a key that consist of one column, which has an integer type. The key has been declared by using PRIMARY KEY or UNIQUE constraint. The column is associated with a sequence generator (either external or internal, i.e., created by the system automatically because the column has been declared as an identity column). The column does not participate in any foreign key.GeneralINFORMATION_SCHEMA+system catalog base tables2021-03-07 20:59MIT 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 check constraints with regular expressionsFind all CHECK constraints (except NOT NULL) that are associated with a base table or a foreign table column and use a regular expression. It is useful to enforce as many constraints at database level as possible. In this way one improves data quality as well as gives extra information to the database users (including the DBMS engines, development environments, and applications).GeneralINFORMATION_SCHEMA only2022-12-13 12:47MIT License
768Table columns that are associated with a sequence generatorSurrogate key values must be generated by using the system (the sequence generator mechanism in case of PostgreSQL). If there is no usage of sequence generators, then there is a question as to whether there are no surrogate keys in the database at all (could be possible and OK) or (more probable) developers have forgotten to implement the generation of surrogate keys.GeneralINFORMATION_SCHEMA only2021-03-07 21:06MIT License
769Table 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
770Table constraints with the cardinality bigger than oneFind constraints that involve more than one columns. Check as to whether the names follow a common style or not.Generalsystem catalog base tables only2020-11-19 13:34MIT License
771Table 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
772Table 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
773Table has both state and status columnsFind tables that contain both a state and a status column.GeneralINFORMATION_SCHEMA+system catalog base tables2023-01-14 15:26MIT License
774Table has multiple columns for free-form descriptionsFind tables that contain multiple columns for free-form textual descriptions. Make sure that the names of columns are understandable and sufficiently different. Make sure that there are no duplicate columns.GeneralINFORMATION_SCHEMA+system catalog base tables2023-01-14 15:36MIT License
775Table inheritanceFind inheritance between base tables. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables.Generalsystem catalog base tables only2020-11-15 13:02MIT License
776Table inheritance (path view)Find in case of each base table that participates in a table inheritance hierarchy the path to the table from the top-level table. Use table inheritance carefully because, for instance, certain constraints are not inherited and must be redefined on child tables. Also make sure that the identifier of each child table in an inheritance hierarchy is a hyponym of the identifier of its parent table.Generalsystem catalog base tables only2022-11-13 16:13MIT License
777Table privilegesCheck as to whether there are no unnecessary privileges.GeneralINFORMATION_SCHEMA only2020-12-29 10:38MIT License
778Table 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
779Table, 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
780Tables that have associated user triggersFind information about tables that are associated with triggers.Generalsystem catalog base tables only2020-11-06 14:51MIT License