From: | iosif <852048472(at)qq(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | There is a redundant check in check_outerjoin_delay() in version 15.14 and below |
Date: | 2025-10-21 10:58:57 |
Message-ID: | tencent_9A93E919E4393ACD23299A4A6851192E3708@qq.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi:
The following snippet is cited from version 15.14, function check_outerjoin_delay()
2055: /* yes; have we included all its rels in relids? */
2056: if (!bms_is_subset(sjinfo->min_lefthand, relids) ||
2057: !bms_is_subset(sjinfo->min_righthand, relids))
2058: {
2059: /* no, so add them in */
2060: relids = bms_add_members(relids, sjinfo->min_lefthand);
2061: relids = bms_add_members(relids, sjinfo->min_righthand);
2062: outerjoin_delayed = true;
2063: /* we'll need another iteration */
2064: found_some = true;
2065: }
2066: /* track all the nullable rels of relevant OJs */
2067: nullable_relids = bms_add_members(nullable_relids,
2068: sjinfo->min_righthand);
2069: if (sjinfo->jointype == JOIN_FULL)
2070: nullable_relids = bms_add_members(nullable_relids,
2071: sjinfo->min_lefthand);
2072: /* set delay_upper_joins if needed */
2073: if (is_pushed_down && sjinfo->jointype != JOIN_FULL &&
2074: bms_overlap(relids, sjinfo->min_lefthand))
2075: sjinfo->delay_upper_joins = true;
The check at line 2074 is redundant and can be safely removed. If relids doesn't initially include sjinfo->min_lefthand, then the condition at line 2056 will be met, and relids will be augmented to include the whole sjinfo->min_lefthand at line 2060, making it overlap with sjinfo->min_lefthand; If relids does initially include sjinfo->min_lefthand,then it also overlap with sjinfo->min_lefthand. The condition at 2074 is gratified anyway, so this check is removale
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2025-10-21 11:26:50 | Re: Add \pset options for boolean value display |
Previous Message | Amit Kapila | 2025-10-21 10:27:46 | Re: Invalid primary_slot_name triggers warnings in all processes on reload |