@@ -1247,16 +1247,11 @@ remove_nulling_relids_mutator(Node *node,
1247
1247
!bms_is_member (var -> varno , context -> except_relids ) &&
1248
1248
bms_overlap (var -> varnullingrels , context -> removable_relids ))
1249
1249
{
1250
- Relids newnullingrels = bms_difference (var -> varnullingrels ,
1251
- context -> removable_relids );
1252
-
1253
- /* Micro-optimization: ensure nullingrels is NULL if empty */
1254
- if (bms_is_empty (newnullingrels ))
1255
- newnullingrels = NULL ;
1256
1250
/* Copy the Var ... */
1257
1251
var = copyObject (var );
1258
1252
/* ... and replace the copy's varnullingrels field */
1259
- var -> varnullingrels = newnullingrels ;
1253
+ var -> varnullingrels = bms_difference (var -> varnullingrels ,
1254
+ context -> removable_relids );
1260
1255
return (Node * ) var ;
1261
1256
}
1262
1257
/* Otherwise fall through to copy the Var normally */
@@ -1268,26 +1263,20 @@ remove_nulling_relids_mutator(Node *node,
1268
1263
if (phv -> phlevelsup == context -> sublevels_up &&
1269
1264
!bms_overlap (phv -> phrels , context -> except_relids ))
1270
1265
{
1271
- Relids newnullingrels = bms_difference (phv -> phnullingrels ,
1272
- context -> removable_relids );
1273
-
1274
1266
/*
1275
- * Micro-optimization: ensure nullingrels is NULL if empty.
1276
- *
1277
1267
* Note: it might seem desirable to remove the PHV altogether if
1278
1268
* phnullingrels goes to empty. Currently we dare not do that
1279
1269
* because we use PHVs in some cases to enforce separate identity
1280
1270
* of subexpressions; see wrap_non_vars usages in prepjointree.c.
1281
1271
*/
1282
- if (bms_is_empty (newnullingrels ))
1283
- newnullingrels = NULL ;
1284
1272
/* Copy the PlaceHolderVar and mutate what's below ... */
1285
1273
phv = (PlaceHolderVar * )
1286
1274
expression_tree_mutator (node ,
1287
1275
remove_nulling_relids_mutator ,
1288
1276
(void * ) context );
1289
1277
/* ... and replace the copy's phnullingrels field */
1290
- phv -> phnullingrels = newnullingrels ;
1278
+ phv -> phnullingrels = bms_difference (phv -> phnullingrels ,
1279
+ context -> removable_relids );
1291
1280
/* We must also update phrels, if it contains a removable RTI */
1292
1281
phv -> phrels = bms_difference (phv -> phrels ,
1293
1282
context -> removable_relids );
0 commit comments