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...
541User-defined routines that implement UPSERT operationFind user-defioned routines that implement UPSERT operation. Make sure that it is consistent with the contracts of database operations.GeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 17:02MIT License
542Sorting rows based on random values in routines without limiting rowsFind routines that contain a statement that sorts rows based on random values but do not limit the number of rows. This is unnecessary because without sorting the rows are returned in a unspecified order. Sorting based on random values is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:57MIT License
543Sorting rows based on random values in routinesFind routines that contain a statement that sorts rows based on random values. This can be used to find a random subset of rows. It is a computationally expensive operation.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:56MIT License
544Case insensitive searchRefers to the column pg_proc.prokind and thus works starting from PostgreSQL 11. Find user-defined routines and derived tables (views/materialized views) that have a subquery with case insensitive search (by using the upper or lower function or ILIKE predicate or (?i) modifier of a regular expression pattern).GeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:55MIT License
545Incorrect reference to a system-defined function in the routine bodyFind user-defined routines that possibly use incorrect name of a system-defined function (currenttimestamp (correct is current_timestamp), currentdate (correct is current_date), currenttime (correct is current_time), local_time (correct is localtime), local_timestamp (correct is localtimestamp),localdate (there is no such function),local_date (there is no such function), sessionuser (correct is session_user), ucase (correct is upper), lcase (correct is lower)). The problem can arise only if the routine uses dynamic SQL. In case of static SQL the DBMS checks the SQL statemen at the creation time and finds out that for instance, SELECT Count(*) AS cnt FROM Emp WHERE hiredate<=currentdate; is incorrect statement because currentdate is not a function name and there is no column currentdate in the table Emp.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:48MIT License
546NOT IN or <> ALL in routinesAvoid using NOT IN or <>ALL with a non-correlated subquery in PostgreSQL because the query performance will be very poor.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:42MIT License
547Perhaps Count(*) is wrongly usedFind user-defined routines and derived tables (views/materialized views) that have a subquery that invokes Count aggregate function like this - Count(*), uses outer join, and grouping. In case of grouping you do not want to get an answer that an empty group contains one member.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:40MIT License
548User-defined routines that produce a temporary tableFind user user-defined routines that produce a temporary tableGeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:25MIT License
549Do not create user-defined routines that have the same name as some installed extension routineAvoid creating user-defined routines that have the same name as some extension routine because it may cause confusion.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:14MIT License
550Overloading may cause runtime errorRoutines in the same schema that have the same name and that have parameters with different types or different number of parameters are not considered to be in conflict at the creation time. However, if defaults are provided in the definition of parameters, then these routines might be conflict during runtime.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:11MIT License
551Routines with the same name and parameters in different schemasFind user-defined routines with the same name and parameters (including the order of parameters) in different schemas.GeneralINFORMATION_SCHEMA+system catalog base tables2021-10-25 16:11MIT License
552Number of columns covered with constraintsFor different types of constraints find the number of columns covered with constraints of such type.Sofware measureINFORMATION_SCHEMA+system catalog base tables2021-10-16 11:01MIT License
553Base tables with exactly one keyFind all base tables that have exactly one PRIMARY KEY or UNIQUE constraint. Find and enforce all the keys. Are you sure there are not more keys in the table?Generalsystem catalog base tables only2021-10-16 10:39MIT License
554All key constraintsFind all the primary key and unique constraints of base tables.Generalsystem catalog base tables only2021-10-16 10:37MIT License
555Primary key columns are not the first in a tableIn SQL tables each column has the ordinal position. Find all the base tables where the primary key columns are not the first in the table, i.e., there is at least one non-primary key column that comes before a primary key column. It is easier to grasp the primary key if its columns are the first in the table. It could be that a table inherits from an abstract table where no keys have been defined.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-10-16 10:33MIT License
556Definition of a non-minimal superkey instead of a candidate key (based on key constraints)Find primary/key unique constraints (sets of columns) that are proper subsets of other primary key/unique constraints of the same table. Candidate key is a minimal superkey, meaning that it is not possible to remove columns from the candidate key without losing its uniqueness property. One should define primary key's and unique constraints based on candidate keys, i.e., the keys should not have redundancy in terms of columns.Problem detectionsystem catalog base tables only2021-10-16 10:29MIT License
557Duplicate keysFind completely overlapping key (primary key and unique) constraints. This is a form of duplication. It leads to the creation of multiple indexes to the same set of columns.Problem detectionsystem catalog base tables only2021-10-16 10:27MIT License
558Base table columns for recording geographic coordinates that do not have a suitable type (based on column names)Find base table columns that are according to the name meant for recording geographic coordinate but do not have a suitable type (numeric or point).Problem detectionINFORMATION_SCHEMA only2021-10-08 12:01MIT License
559Base table columns for recording geographic coordinates (based on column names)Find base table columns that are according to the name meant for recording coordinates.GeneralINFORMATION_SCHEMA only2021-10-08 11:59MIT License
560Deferrable foreign key constraint with a RESTRICT compensating actionFind deferrable foreign key constraint with ON UPDATE RESTRICT or ON DELETE RESTRICT compensating action. Referential actions are carried out before, and are not part of, the checking of a referential constraint. Deferring a referential constraint defers the checking of the of the constraint (a ) but does not defer the referential actions of the referential constraint. In PostgreSQL the essential difference between NO ACTION and RESTRICT is that NO ACTION allows the check to be deferred until later in the transaction, whereas RESTRICT does not. Thus RESTRICT could result with the failure of data modification where in case of NO ACTION the modification would succeed.Problem detectionsystem catalog base tables only2021-10-08 11:29MIT License