| Goal | This query identifies CHECK constraints on TIMESTAMPTZ and TSTZRANGE columns that use timestamp literals with fixed UTC offsets instead of named time zones. This practice is flagged as a design flaw because fixed offsets do not account for Daylight Saving Time (DST), leading to constraints on both single timestamps and range boundaries that are unable to correctly represent a local time zone's rules throughout the entire year. |
|---|---|
| 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 | Better check in case of the example: CHECK ( reg_time >= '2025-01-01 00:00:00' AT TIME ZONE 'Europe/Tallinn' AND reg_time < '2026-01-01 00:00:00' AT TIME ZONE 'Europe/Tallinn'); |
| Data Source | INFORMATION_SCHEMA 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.
Temporal data
Queries of this category provide information about temporal (time-related) data that is kept in the database.
| Name | Description |
|---|---|
| CHECK constraints | Queries of this category provide information about CHECK constraints. |
| Temporal data | Queries of this category provide information about temporal (time-related) data that is kept in the database. |