| Goal | Find 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. |
|---|---|
| Notes | The query considers both check constraints that are directly associated with a table as well as check constraints that are associated with the table through a domain. |
| Type | Problem detection (Each row in the result could represent a flaw in the design) |
| Reliability | Medium (Medium number of false-positive results) |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Change the check constraint or the data type of the column. For instance, if column reg_time has type TIMESTAMP, then instead of reg_time <= CURRENT_TIMESTAMP or reg_time<=CURRENT_DATE, one should use cart_item_created_at <= LOCALTIMESTAMP. |
| Data Source | system catalog only |
| SQL Query |
|
Collections
This query belongs to the following collections:
Find problems automatically
Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not .
| Name | Description |
|---|---|
| Find problems automatically | Queries, that results point to problems in the database. Each query in the collection produces an initial assessment. However, a human reviewer has the final say as to whether there is a problem or not . |
Categories
This query is classified under the following categories:
CHECK constraints
Queries of this category provide information about CHECK constraints.
Domains
Queries of this category provide information about reusable specifications of column properties.
Inconsistencies
Queries of this catergory provide information about inconsistencies of solving the same problem in different places.
| Name | Description |
|---|---|
| CHECK constraints | Queries of this category provide information about CHECK constraints. |
| Domains | Queries of this category provide information about reusable specifications of column properties. |
| Inconsistencies | Queries of this catergory provide information about inconsistencies of solving the same problem in different places. |