Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Bykov Ivan <i(dot)bykov(at)modernsys(dot)ru>, Michael Paquier <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET
Date: 2025-03-10 17:20:57
Message-ID: CAA5RZ0sG42-Hyes4U9BToNHfxGx8tkW_HuRkQ0pOmmx6Ud7eiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> transformation. For these reasons, variant A where we put the
> LimitOption between the two int8 expression nodes feels like the
> "okay" approach here. But we must document this expectation in the
> structure, and check for more grammar variants of LIMIT and OFFSET
> clauses in pgss.

Please see the attached. Variant A with comments and some additional
test cases.

It should be noted that we currently have "WITH TIES/ROWS ONLY" tests in pg_s_s,
so I added another case to show "FETCH FIRST 2 ROW ONLY" and "LIMIT 2" are
the same queryId and also added a query that uses both a LIMIT and OFFSET.

I could not think of other cases we need to cover.

--

Sami

Attachment Content-Type Size
v1-0001-Fix-QueryId-collision-for-LIMIT-and-OFFSET.patch application/octet-stream 2.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-03-10 17:35:56 Re: Changing the state of data checksums in a running cluster
Previous Message Ranier Vilela 2025-03-10 16:55:41 Re: table_tuple_lock's snapshot argument