Re: BUG #19873: planner silently drops the second ORDER BY sort key when both keys reference the same expression und

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 303677365(at)qq(dot)com
Subject: Re: BUG #19873: planner silently drops the second ORDER BY sort key when both keys reference the same expression und
Date: 2026-11-30 05:35:59
Message-ID: CAGRkXqQPsuVNkK7OKq7wOa109v=46FGcidb4AdHVyduPTRyOjg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Zsolt,

Thanks for finding the DISTINCT ON and incremental sort regressions.

I was wrong that v3-0001 could go in alone, so v4-0001 has the grouping fix.
It also fixes your citext case.
Tom mentioned ~<~ is a C-locale sort and v4 now plans it that way.

v4-0002 fixes WITH TIES and window peers. It changes results, so I
think it is for HEAD only.

Aggregate DISTINCT is back to what master does and can still return
duplicates.

With that patch, I think postgres_fdw no longer pushes down such a sort.

Thanks,
Shihao

Attachment Content-Type Size
v4-0001-Fix-pattern_ops-sort-keys-under-nondeterministic-col.patch application/octet-stream 16.1 KB
v4-0002-Compare-sort-peers-the-way-pattern_ops-sorted-them.patch application/octet-stream 4.8 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ayush Tiwari 2026-11-30 05:45:21 Re: BUG #19824: OMIT QUOTES breaks non-string results: array / composite / array-domain coercions in JSON_QUERY / JS
Previous Message Ayush Tiwari 2026-11-30 05:29:10 Re: BUG #19723: CREATE INDEX racing with ALTER INDEX ATTACH PARTITION triggers unexpected internal error