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

Sami Imseih <samimseih@gmail.com>

From: Sami Imseih <samimseih@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Bykov Ivan <i.bykov@modernsys.ru>, Michael Paquier <michael@paquier.xyz>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2025-03-10T17:20:57Z
Lists: pgsql-hackers

Attachments

> 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

Commits

  1. Optimize Query jumble