Skip to content
Sarj Code Standards

enforce-timestamptz

TIMESTAMP without TIME ZONE — use TIMESTAMPTZ.

Why

Naive timestamps discard offset context and make cross-time-zone comparisons ambiguous.

Fix

Declare persisted instants as TIMESTAMPTZ or TIMESTAMP WITH TIME ZONE.

Examples

Before — flagged Naive timestamp column
supabase/migrations/001_orders.sql
CREATE TABLE orders (created_at TIMESTAMP NOT NULL);
After — preferred Timestamp with time-zone semantics
supabase/migrations/001_orders.sql
CREATE TABLE orders (created_at TIMESTAMPTZ NOT NULL);
Before — flagged A column identifier does not hide a naive cast
supabase/queries/events.sql
SELECT
timestamp::TIMESTAMP
FROM
events;
After — preferred A column identifier does not declare a naive type
supabase/queries/events.sql
SELECT
timestamp
FROM
events;