Re: remove_useless_joins vs. bug #19560 - Mailing list pgsql-hackers

From Jacob Brazeal
Subject Re: remove_useless_joins vs. bug #19560
Date
Msg-id CA+COZaAVP6yHvSw6SQt6tieDhXCdDCK7qXTQP4fpiF4hsnVAPg@mail.gmail.com
Whole thread
Responses Re: remove_useless_joins vs. bug #19560
List pgsql-hackers
These patches fix all my known failure cases (attached.) In addition, as a plus, a small set of queries that previously didn't compile are now accepted, for example:

SELECT coalesce(u1.id + 1, 1) AS o0
FROM (u AS u1 FULL JOIN (u AS u2 JOIN u AS u3 ON u2.id = u3.id)
              ON u2.id = u2.id)
GROUP BY 1;

... previously gave ERROR:  FULL JOIN is only supported with merge-joinable or hash-joinable join conditions

now returns 10 rows (`2 … 11`), which I believe is correct.

```
 HashAggregate
   Group Key: COALESCE((u1.id + 1), 1)
   ->  Merge Full Join
         ->  Seq Scan on u u1
         ->  Materialize
               ->  Seq Scan on u u3
```

So that's nice.

On Sat, Jul 25, 2026 at 7:15 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Here's a patchset addressing that.  0001-0003 are the same as before,
and then 0004 fixes this bug and adds tests.

Your Claude session mentioned a different failure scenario, but
gave no examples so I'm not quite sure if this covers it or not.

                        regards, tom lane

Attachment

pgsql-hackers by date:

Previous
From: Chengpeng Yan
Date:
Subject: Re: Extended statistics improvement: multi-column MCV missing values
Next
From: Jacob Brazeal
Date:
Subject: Re: remove_useless_joins vs. bug #19560