is there any query that can cover these statements in join_is_legal()?

From: g l <orangegrove(at)live(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: is there any query that can cover these statements in join_is_legal()?
Date: 2025-05-09 13:10:55
Message-ID: SY4P282MB38106619E47359621848173EDA8AA@SY4P282MB3810.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi:
In join_is_legal(), i wonder wether the 2 "return false" statements can be covered by any query.

            /*
             * If one input contains min_lefthand and the other contains
             * min_righthand, then we can perform the SJ at this join.
             *
             * Reject if we get matches to more than one SJ; that implies we're
             * considering something that's not really valid.
             */
            if (bms_is_subset(sjinfo->min_lefthand, rel1->relids) &&
                  bms_is_subset(sjinfo->min_righthand, rel2->relids))
            {
                  if (match_sjinfo)
                        return false;     /* invalid join path */
                  match_sjinfo = sjinfo;
                  reversed = false;
            }
            else if (bms_is_subset(sjinfo->min_lefthand, rel2->relids) &&
                         bms_is_subset(sjinfo->min_righthand, rel1->relids))
            {
                  if (match_sjinfo)
                        return false;     /* invalid join path */
                  match_sjinfo = sjinfo;
                  reversed = true;
            }
There is no query in regression test suite that can render the 2 decisions based on match_sjinfo true, nor can i figure out such a query. Can these conditions ever be true? If they can be true, what is the query that make them true?
Any feedback is welcome.

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2025-05-09 13:19:35 Re: strange perf regression with data checksums
Previous Message Tomas Vondra 2025-05-09 13:06:30 Re: strange perf regression with data checksums