Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: tharakan(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order
Date: 2026-11-20 18:17:17
Message-ID: 1537677.1795198637@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Oh, I have it: the right fix here is to leave the right subquery's
tlist entirely alone, and instead compute the extra columns in its
parent query. The reason we didn't see a problem for #19922 in
the lefthand subquery is that it's done that way for the lefthand
subquery; but for some reason we didn't do it like that for the
righthand one.

Now that I look more closely, I think that the SQL spec's rewrite
rule actually directs us to do it like that. So there's no
semantic hazard in the spec, only in our implementation.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Maciej Jaros 2026-11-20 18:41:32 Re: BUG #19927: PostgreSQL 16: SQL dump adds experimental/incompatible options like \restrict
Previous Message Tom Lane 2026-11-20 17:52:54 Re: BUG #19923: SEARCH/CYCLE with DISTINCT in the recursive term: rows depend on input order