Var *newvar = copyVar(var);
/*
- * Assert that we kept all the nullingrels machinations straight.
+ * Verify that we kept all the nullingrels machinations straight.
*
* XXX we skip the check for system columns and whole-row Vars.
* That's because such Vars might be row identity Vars, which are
* columns, it seems unlikely that a bug in nullingrels logic
* would affect only system columns.)
*/
- Assert(varattno <= 0 ||
- (nrm_match == NRM_SUBSET ?
- bms_is_subset(var->varnullingrels, vinfo->varnullingrels) :
- nrm_match == NRM_SUPERSET ?
- bms_is_subset(vinfo->varnullingrels, var->varnullingrels) :
- bms_equal(vinfo->varnullingrels, var->varnullingrels)));
+ if (!(varattno <= 0 ||
+ (nrm_match == NRM_SUBSET ?
+ bms_is_subset(var->varnullingrels, vinfo->varnullingrels) :
+ nrm_match == NRM_SUPERSET ?
+ bms_is_subset(vinfo->varnullingrels, var->varnullingrels) :
+ bms_equal(vinfo->varnullingrels, var->varnullingrels))))
+ elog(ERROR, "wrong varnullingrels %s (expected %s) for Var %d/%d",
+ bmsToString(var->varnullingrels),
+ bmsToString(vinfo->varnullingrels),
+ varno, varattno);
newvar->varno = newvarno;
newvar->varattno = vinfo->resno;
if (phv->phid != subphv->phid)
continue;
- /* Assert that we kept all the nullingrels machinations straight */
- Assert(nrm_match == NRM_SUBSET ?
- bms_is_subset(phv->phnullingrels, subphv->phnullingrels) :
- nrm_match == NRM_SUPERSET ?
- bms_is_subset(subphv->phnullingrels, phv->phnullingrels) :
- bms_equal(subphv->phnullingrels, phv->phnullingrels));
+ /* Verify that we kept all the nullingrels machinations straight */
+ if (!(nrm_match == NRM_SUBSET ?
+ bms_is_subset(phv->phnullingrels, subphv->phnullingrels) :
+ nrm_match == NRM_SUPERSET ?
+ bms_is_subset(subphv->phnullingrels, phv->phnullingrels) :
+ bms_equal(subphv->phnullingrels, phv->phnullingrels)))
+ elog(ERROR, "wrong phnullingrels %s (expected %s) for PlaceHolderVar %d",
+ bmsToString(phv->phnullingrels),
+ bmsToString(subphv->phnullingrels),
+ phv->phid);
/* Found a matching subplan output expression */
newvar = makeVarFromTargetEntry(newvarno, tle);