Repeat the condition check twice in function distribute_qual_to_rels

From: "bigbro_wq(at)hotmail(dot)com" <bigbro_wq(at)hotmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Repeat the condition check twice in function distribute_qual_to_rels
Date: 2024-11-03 06:18:47
Message-ID: TYCPR01MB6093C42081BD8EC36E03478F85502@TYCPR01MB6093.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I notice that check the condtion again when after invoked process_equivalence and return failed.

if (restrictinfo->mergeopfamilies)
{
if (maybe_equivalence)
{
if (process_equivalence(root, &restrictinfo, jtitem->jdomain))
{
/* distribute to base */
int relid;
if (bms_get_singleton_member(restrictinfo->required_relids, &relid))
{
restrictinfo->fromec = true;
distribute_restrictinfo_to_rels(root, restrictinfo);
}
return;
}
/* EC rejected it, so set left_ec/right_ec the hard way ... */
if (restrictinfo->mergeopfamilies) /* EC might have changed this */
initialize_mergeclause_eclasses(root, restrictinfo);
/* ... and fall through to distribute_restrictinfo_to_rels */
}
-----------------------------------------------------------------------------------
Above the codes, check the condition again when invoked process_equivalence failed,
but it's already under the positive condition "if (restrictinfo->mergeopfamilies)".
It's necessary ?
bigbro_wq(at)hotmail(dot)com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message feichanghong 2024-11-03 11:56:43 Re: Improve the efficiency of _bt_killitems.
Previous Message Bertrand Drouvot 2024-11-03 04:25:41 Clear padding in PgStat_HashKey keys