Re: timestamp vs. timestamptz comparisons inconsistently ordered under DST

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Jacob Brazeal <jacob(dot)brazeal(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: timestamp vs. timestamptz comparisons inconsistently ordered under DST
Date: 2026-07-27 17:06:20
Message-ID: 3970458.1785171980@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> writes:
> On Mon, 2026-07-27 at 08:23 -0400, Tom Lane wrote:
>> I thought for a bit about changing the support function
>> timestamp_cmp_timestamptz so that it instead converts the
>> timestamptz side down to timestamp. That would make an index
>> search work consistently ... but it would be inconsistent with
>> what the SQL-accessible operators do, so I think it's a nonstarter.

> What if we change the definition of the SQL operators accordingly?
> That should only affect very few actual values. We can do that
> in master, with a note in the compatibility section, right?

It would behave very strangely I think: you'd have a situation where,
eg,
A::timestamp > B::timestamptz
B::timestamptz < A::timestamp
sometimes give different answers, so that we'd have to stop marking
them as commutators. The downsides of that seem pretty awful.

> But wouldn't that also mean that very few people are going to be
> unhappy if we backpatch a change in the behavior of the SQL
> operators?

Backpatching a behavioral change like this seems awfully scary.
For the moment I'm just contemplating what we could potentially
change in master. So far I don't like any of the choices :-(

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Srinath Reddy Sadipiralla 2026-07-27 17:27:45 Re: SQL/JSON: JSON_TRANSFORM (SQL standard, subclause 6.44)
Previous Message Florin Irion 2026-07-27 16:45:08 Re: pg_plan_advice: add NO_ scan and join method tags