Goal | Do not create a constraint in case of which data that satisfied a constraint c at the registration time suddenly does not satisfy it any more as the time goes by. Find all the check constraints that use non-deterministic functions (now, current_timestamp, localtimestamp, current_date, current_time) in a way that makes this situation possible. Fort instance, localtimestamp(0)>end_date is an example of such constraint. |
Notes | The query takes into account constraints that are associated directly with the column as well as constraints that are associated with the column through a domain. The query does not find CHECK constraints of domains that are not associated with any table. According to the SQL standard: Certain privileges. No integrity constraint shall be defined using a |
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 License |
Fixing Suggestion | Drop the constraints. Implement the checks by using triggers, user-defined routines, or in the application. |
Data Source | INFORMATION_SCHEMA only |
SQL Query |
|
SQL statements that help generate fixes for the identified problem.
SQL Query to Generate Fix | Description |
---|---|
| Drop the constraint that is associated directly with the table. |
| Drop the constraint that is associated with the domain. |
This query belongs to the following collections:
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 . |
This query is classified under the following categories:
Name | Description |
---|---|
CHECK constraints | Queries of this category provide information about CHECK constraints. |
System-defined functions | Queries of this category provide information about the use of system-defined functions. |
Temporal data | Queries of this category provide information about temporal (time-related) data that is kept in the database. |
Validity and completeness | Queries of this category provide information about whether database design represents the world (domain) correctly (validity) and whether database design captures all the information about the world (domain) that is correct and relevant (completeness). |