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...
161Boolean column for genderFind base table columns that have Boolean type and based on the column name are meant for recording data about gender.Problem detectionINFORMATION_SCHEMA only2022-04-18 00:57MIT License
162Three-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
163Duplicate DEFAULT values of base table columnsFind base table columns that have both default value determined through a domain and default value that is directly attached to the column. Do not duplicate specifications of default values to avoid confusion and surprises. If column and domain both have a default value, then in case of inserting data the default value that is associated directly with the column is used.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
164Perhaps the type of a base table column/domain should be VARCHAR (based on column names)Find base table columns that have CHAR type, where character maximum length is bigger than 1 and the name of the column does not refer to the possibility that the column holds some kind of codes or flags or hash values.Problem detectionINFORMATION_SCHEMA only2023-11-12 10:48MIT License
165Do not use FLOAT Data TypeFind base table columns that have FLOAT, REAL, or DOUBLE PRECISION type. "The data types real and double precision are inexact, variable-precision numeric types. On all currently supported platforms, these types are implementations of IEEE Standard 754 for Binary Floating-Point Arithmetic (single and double precision, respectively), to the extent that the underlying processor, operating system, and compiler support it." (PostgreSQL documentation) Do not use the approximate numeric types FLOAT, REAL, and DOUBLE PRECISION in order to present fractional numeric data. Due to the use of the IEEE 754 standard the results of calculations with the values, which have one of these types, can be inexact because out of necessity some numbers must be rounded to a value, which is very close. "Comparing two floating-point values for equality might not always work as expected." (PostgreSQL documentation)Problem detectionINFORMATION_SCHEMA only2021-03-12 15:41MIT License
166Reference to the numeric type is too imprecise, i.e., precision and scale are missingFind base table columns that have the DECIMAL/NUMERIC type, but do not have precision and scale specified. "Specifying: NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale."Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
167Base table columns with the same name and type have different field sizesFind base table columns that have the same name and type but different field size.Problem detectionINFORMATION_SCHEMA only2021-03-28 16:59MIT License
168Base table column name is the same as its domain nameFind base table columns that have the same name as the domain name or the data type name of the column. The names may have different uppercase/lowercase characters. Columns, domains, and types are different concepts in SQL and perhaps it is better to use different names in case of these.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
169Base table columns with the same name have different typesFind base table columns that have the same name but different type. In general, base tables columns that have the same name should have the same type as well.Problem detectionINFORMATION_SCHEMA only2023-01-14 20:54MIT License
170Unnecessary usage of the numeric type in case of base table columnsFind base table columns that have type NUMERIC and the scale is 0, i.e., one can record in the column only integer values. Arithmetic operations are slower in case of the numeric type compared to an integer type. Thus, in order to record integer values, one should use columns with the type SMALLINT, INTEGER, or BIGINT instead of NUMERIC(p,0).Problem detectionINFORMATION_SCHEMA only2021-02-25 17:30MIT License
171Perhaps spaces are unnecessarily restrictedFind base table columns that name refers to the possibility that the column is used to record names or textual descriptions but the column seems to have a simple check constraint that restricts spaces in these.Problem detectionINFORMATION_SCHEMA+system catalog base tables2023-11-18 13:30MIT License
172Perhaps the type of a base table column/domain should be temporal (deadlines)Find base table columns that name refers to the possibility that there are registered deadlines but the column does not have a temporal type.Problem detectionINFORMATION_SCHEMA only2021-03-21 17:00MIT License
173Base table column of comments/descriptions has an incorrect data type or maximum character lengthFind base table columns that name refers to the possibility that these are used to register comments/descriptions. Find the columns where the data type is not VARCHAR and TEXT or in case of VARCHAR the maximum number of permitted characters is smaller than 1000. In case of determining field sizes choose a size that permits registration of all possible legal values.Problem detectionINFORMATION_SCHEMA only2022-05-01 13:39MIT License
174Base table column of sums of money has too big or small scaleFind base table columns that name refers to the possibility that these are used to register data about prices/sums of money. Find the columns that have decimal type but have a too big (bigger than six) or a too small scale (zero). The selection of field size must be precise and should take into account the possible data in the column.Problem detectionINFORMATION_SCHEMA only2021-03-21 11:45MIT License
175Inconsistency between the name and the type of a base table column (dates)Find base table columns that name refers to the possibility that these are used to register dates. Find the columns that do not have an appropriate data type. Column names should reflect the data that is possible to record in the column. For instance, in case of temporal data the column name should indicate as to whether we record dates or timestamps. If the column data type is "date", then the suffix of the column name should be "kp" (Estonian) or "date" (English).Problem detectionINFORMATION_SCHEMA only2021-03-27 16:16MIT License
176Columns of base tables with data about postal addresses, file addresses, or web addresses that have an incorrect data typeFind base table columns that name refers to the possibility that these are used to register file/web addresses. Find the columns where the type refers to the possibility that values in the column are actual files.Problem detectionINFORMATION_SCHEMA only2021-03-27 13:46MIT License
177Base table column of measurements does not have a correct data typeFind base table columns that name refers to the possibility that these are used to register measurement results. Find the columns that do not have an integer or numeric type.Problem detectionINFORMATION_SCHEMA only2021-02-25 17:29MIT License
178Field size is not sufficiently different in case of base table columnsFind base table columns that name refers to the possibility that these are used to register names. Find base table columns that name refers to the possibility that these are used to register comments/descriptions/etc. Find the cases where a base table contains columns from the both sets and the field size in case of the latter is not at least twice as big as in case of the former. For example, if the name of a service can be 100 character long, then it is quite illogical that the description of the service is only at most 200 characters long.Problem detectionINFORMATION_SCHEMA only2021-03-27 18:51MIT License
179Base table has a national identification number as a keyFind base table columns that name refers to the possibility that these are used to register national identification numbers (personal codes). Find the columns that constitute a key of a table. This in turn enforces a (restrictive) business rule that all persons of interest come from one country. Make sure that the enforced constraint is valid, i.e., there is indeed such rule in the domain.GeneralINFORMATION_SCHEMA+system catalog base tables2020-11-06 14:51MIT License
180Password should not be open textFind base table columns that name refers to the possibility that these are used to register passwords. Find the columns that have a CHECK constraint that seems to determine the minimal or maximal permitted length of the values in the column. Passwords in a database table must be hashed and salted. Checking the strength of the password by using a check constraint is in this case impossible and the check constraints that try to do it should be removed from the database.Problem detectionINFORMATION_SCHEMA+system catalog base tables2021-02-25 17:29MIT License