Filter Queries
Found 1053 queries.
- All the queries about database objects contain a subcondition to exclude from the result information about the system catalog.
- Although the statements use SQL constructs (common table expressions; NOT in subqueries) that could cause performance problems in case of large datasets it shouldn't be a problem in case of relatively small amount of data, which is in the system catalog of a database.
- Statistics about the catalog content and project home in GitHub that has additional information.
#141. Percentage of optional columns in each base table
INFORMATION_SCHEMA onlyWhat is the percentage of optional columns (that permit NULLs) in case of each base table? It is better to prohibit the use of NULLs in as many columns as possible. Otherwise the results of queries may be misleading.
#142. Perhaps an unnecessary default value (the empty string or a string that consists of only whitespace) of a base table column/domain
INFORMATION_SCHEMA onlyThis query identifies table columns and domains that are configured with a semantically void DEFAULT value. It specifically flags defaults that are an empty string ('') or a string consisting solely of whitespace characters (e.g., spaces, newlines). This practice is a design flaw because it automatically populates the database with non-substantive data, which can lead to application-level bugs when code does not explicitly check for such "blank" values in addition to NULL.
#143. Perhaps a redundant column (based on sequence generators)
INFORMATION_SCHEMA onlyFind base tables where more than one column gets the default value by using the sequence generator mechanism.
#144. Perhaps a state machine is implemented with timestamp columns
INFORMATION_SCHEMA onlyFind implementations of state machines that uses a set of columns with a timestamp type.
#145. Perhaps a too simplified state machine
INFORMATION_SCHEMA onlyFind base table columns with Boolean type that name refers to the possibility that these are used to register as to whether an entity is currently in active state or not. Find the base tables that have exactly one Boolean column. During the system design one should find all the possible states of an entity type that influence the behavior of the information system. Data as to whether an entity is in one of these states should be in the database. Having only two states - active/inactive - is sometimes a too big simplification.
#146. Perhaps checking of file extension is incorrect
INFORMATION_SCHEMA onlyFind check constraints of tables that use a regular expression to check as to whether a registered string ends with an appropriate file extension. However, the expression does not put the dot sign into the square brackets nor does have the escape character \before it, i.e., it is interpreted as a single character not as the dot sign in the expression. In regular expressions the dot (.) matches any single character except the newline character.
#147. Perhaps incorrect column name (based on default values)
INFORMATION_SCHEMA onlyThis query identifies a semantic mismatch between column definitions and their identifiers. It flags base table columns that are configured with a DEFAULT value of CURRENT_USER or SESSION_USER (indicating they store user identity) but whose names fail to reflect this purpose. Specifically, it searches for columns lacking semantic cues such as "user", "login", "owner", or "by" in their names. This obscuration reduces schema self-documentation, as developers cannot intuitively determine that the column is intended for audit or ownership tracking.
#148. Perhaps incorrect default vale
INFORMATION_SCHEMA onlyFind columns of base tables that have default value CURRENT_USER.
#149. Perhaps incorrect WHEN clause
INFORMATION_SCHEMA onlyFind row level triggers that have action condition (WHEN clause) but the Boolean expression in its specifications does not refer to neither NEW nor OLD variable.
#150. Perhaps IS DISTINCT FROM should be used instead of <> in WHEN clauses
INFORMATION_SCHEMA onlyUse a right predicate in trigger condition in order to ensure that the trigger executes always when it has to but not more often. IS DISTINCT FROM treats NULL as if it was a known value, rather than unknown. It would be relevant if a column that is referenced in the action condition is optional, i.e., permits NULLs.
#151. Perhaps the column type should be UUID
INFORMATION_SCHEMA onlyFind base table columns that do not have uuid type but the name of the column refers to the possibility that the values in the column are uuid's.
#152. Perhaps the precision in case of a base table column with NUMERIC/DECIMAL type is too small
INFORMATION_SCHEMA onlyMake sure that in case of using the type DECIMAL/NUMERIC as the type of a base table column the precision (the permitted number of digits in the number) is not too small. For instance, the biggest value in the type NUMERIC(1,1) is 0.9.
#153. Perhaps the type of a base table column/domain should be BOOLEAN (based on types and default values)
INFORMATION_SCHEMA onlyFind base table columns and domains that have a textual type and the default value that represents a truth-value. For instance, the type of a column could be VARCHAR and the column has the default value 'TRUE'.
#154. Perhaps the type of a base table column/domain should be INTEGER/SMALLINT/BIGINT (based on sequence generators)
INFORMATION_SCHEMA onlySpecify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that refer to the nextval function by using the default value mechanism but do not have the type INTEGER, SMALLINT, or BIGINT. This check is performed in case of identity columns: ERROR: identity column type must be smallint, integer, or bigint.
#155. Perhaps the type of a base table column/domain should be numeric (based on default values)
INFORMATION_SCHEMA onlySpecify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that have a textual type but the default value that represents a number (for instance, '100', '2', or '0.22'). Exclude columns about formats.
#156. Perhaps the type of a base table column/domain should be SMALLINT (based on classifiers)
INFORMATION_SCHEMA onlyFind columns that name points to the possibility that values in this are classifier codes. The column has a numeric type but it is not SMALLINT. Usually each classifier type has so few values that type SMALLINT would be appropriate.
#157. Perhaps the type of a base table column/domain should be temporal (based on default values)
INFORMATION_SCHEMA onlyFind base table columns and domains that have a textual type but the default value that represents a temporal value (either a static value or invocation of a function that returns such value). Specify for each column/domain a right data type that takes into account expected values in the column/domain.
#158. Perhaps the type of a base table column/domain should be temporal (deadlines)
INFORMATION_SCHEMA onlyFind base table columns that name refers to the possibility that there are registered deadlines but the column does not have a temporal type.
#159. Perhaps the type of a base table column/domain should be VARCHAR (based on column names)
INFORMATION_SCHEMA onlyFind 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.
#160. Perhaps the type of a base table column should be an integer type (based on column names)
INFORMATION_SCHEMA onlyFind columns of base tables where the name of the column has prefix or suffix "id" or has the name "id" but the column does not have an integer type or uuid type. A convention is to use the phrase "id" in the names of surrogate key columns.
| # | Name | Goal | Type | Data source (sorted ascending) | Last update | License | Actions |
|---|---|---|---|---|---|---|---|
| 141 | Percentage of optional columns in each base table | What is the percentage of optional columns (that permit NULLs) in case of each base table? It is better to prohibit the use of NULLs in as many columns as possible. Otherwise the results of queries may be misleading. | Sofware measure | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 142 | Perhaps an unnecessary default value (the empty string or a string that consists of only whitespace) of a base table column/domain | This query identifies table columns and domains that are configured with a semantically void DEFAULT value. It specifically flags defaults that are an empty string ('') or a string consisting solely of whitespace characters (e.g., spaces, newlines). This practice is a design flaw because it automatically populates the database with non-substantive data, which can lead to application-level bugs when code does not explicitly check for such "blank" values in addition to NULL. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 143 | Perhaps a redundant column (based on sequence generators) | Find base tables where more than one column gets the default value by using the sequence generator mechanism. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 144 | Perhaps a state machine is implemented with timestamp columns | Find implementations of state machines that uses a set of columns with a timestamp type. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 145 | Perhaps a too simplified state machine | Find base table columns with Boolean type that name refers to the possibility that these are used to register as to whether an entity is currently in active state or not. Find the base tables that have exactly one Boolean column. During the system design one should find all the possible states of an entity type that influence the behavior of the information system. Data as to whether an entity is in one of these states should be in the database. Having only two states - active/inactive - is sometimes a too big simplification. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 146 | Perhaps checking of file extension is incorrect | Find check constraints of tables that use a regular expression to check as to whether a registered string ends with an appropriate file extension. However, the expression does not put the dot sign into the square brackets nor does have the escape character \before it, i.e., it is interpreted as a single character not as the dot sign in the expression. In regular expressions the dot (.) matches any single character except the newline character. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 147 | Perhaps incorrect column name (based on default values) | This query identifies a semantic mismatch between column definitions and their identifiers. It flags base table columns that are configured with a DEFAULT value of CURRENT_USER or SESSION_USER (indicating they store user identity) but whose names fail to reflect this purpose. Specifically, it searches for columns lacking semantic cues such as "user", "login", "owner", or "by" in their names. This obscuration reduces schema self-documentation, as developers cannot intuitively determine that the column is intended for audit or ownership tracking. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 148 | Perhaps incorrect default vale | Find columns of base tables that have default value CURRENT_USER. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 149 | Perhaps incorrect WHEN clause | Find row level triggers that have action condition (WHEN clause) but the Boolean expression in its specifications does not refer to neither NEW nor OLD variable. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 150 | Perhaps IS DISTINCT FROM should be used instead of <> in WHEN clauses | Use a right predicate in trigger condition in order to ensure that the trigger executes always when it has to but not more often. IS DISTINCT FROM treats NULL as if it was a known value, rather than unknown. It would be relevant if a column that is referenced in the action condition is optional, i.e., permits NULLs. | General | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 151 | Perhaps the column type should be UUID | Find base table columns that do not have uuid type but the name of the column refers to the possibility that the values in the column are uuid's. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 152 | Perhaps the precision in case of a base table column with NUMERIC/DECIMAL type is too small | Make sure that in case of using the type DECIMAL/NUMERIC as the type of a base table column the precision (the permitted number of digits in the number) is not too small. For instance, the biggest value in the type NUMERIC(1,1) is 0.9. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 153 | Perhaps the type of a base table column/domain should be BOOLEAN (based on types and default values) | Find base table columns and domains that have a textual type and the default value that represents a truth-value. For instance, the type of a column could be VARCHAR and the column has the default value 'TRUE'. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 154 | Perhaps the type of a base table column/domain should be INTEGER/SMALLINT/BIGINT (based on sequence generators) | Specify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that refer to the nextval function by using the default value mechanism but do not have the type INTEGER, SMALLINT, or BIGINT. This check is performed in case of identity columns: ERROR: identity column type must be smallint, integer, or bigint. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 155 | Perhaps the type of a base table column/domain should be numeric (based on default values) | Specify for each column/domain a right data type that takes into account expected values in the column/domain. Find base table columns and domains that have a textual type but the default value that represents a number (for instance, '100', '2', or '0.22'). Exclude columns about formats. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 156 | Perhaps the type of a base table column/domain should be SMALLINT (based on classifiers) | Find columns that name points to the possibility that values in this are classifier codes. The column has a numeric type but it is not SMALLINT. Usually each classifier type has so few values that type SMALLINT would be appropriate. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 157 | Perhaps the type of a base table column/domain should be temporal (based on default values) | Find base table columns and domains that have a textual type but the default value that represents a temporal value (either a static value or invocation of a function that returns such value). Specify for each column/domain a right data type that takes into account expected values in the column/domain. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 158 | Perhaps 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 detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 159 | Perhaps 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 detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) | |
| 160 | Perhaps the type of a base table column should be an integer type (based on column names) | Find columns of base tables where the name of the column has prefix or suffix "id" or has the name "id" but the column does not have an integer type or uuid type. A convention is to use the phrase "id" in the names of surrogate key columns. | Problem detection | INFORMATION_SCHEMA only | MIT (opens in new tab) | View (opens in new tab) |