From ad86d159b6ab90b195b06fb5c7b593900a7f9cd8 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 29 Nov 2022 09:39:36 +0100 Subject: Add 'missing_ok' argument to build_attrmap_by_name When it's given as true, return a 0 in the position of the missing column rather than raising an error. This is currently unused, but it allows us to reimplement column permission checking in a subsequent commit. It seems worth breaking into a separate commit because it affects unrelated code. Author: Amit Langote Discussion: https://postgr.es/m/CA+HiwqFfiai=qBxPDTjaio_ZcaqUKh+FC=prESrB8ogZgFNNNQ@mail.gmail.com --- src/backend/executor/execMain.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/backend/executor/execMain.c') diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index ef828e04960..e301c687e37 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1859,7 +1859,7 @@ ExecPartitionCheckEmitError(ResultRelInfo *resultRelInfo, old_tupdesc = RelationGetDescr(resultRelInfo->ri_RelationDesc); /* a reverse map */ - map = build_attrmap_by_name_if_req(old_tupdesc, tupdesc); + map = build_attrmap_by_name_if_req(old_tupdesc, tupdesc, false); /* * Partition-specific slot's tupdesc can't be changed, so allocate a @@ -1944,7 +1944,8 @@ ExecConstraints(ResultRelInfo *resultRelInfo, tupdesc = RelationGetDescr(rootrel->ri_RelationDesc); /* a reverse map */ map = build_attrmap_by_name_if_req(orig_tupdesc, - tupdesc); + tupdesc, + false); /* * Partition-specific slot's tupdesc can't be changed, so @@ -1996,7 +1997,8 @@ ExecConstraints(ResultRelInfo *resultRelInfo, tupdesc = RelationGetDescr(rootrel->ri_RelationDesc); /* a reverse map */ map = build_attrmap_by_name_if_req(old_tupdesc, - tupdesc); + tupdesc, + false); /* * Partition-specific slot's tupdesc can't be changed, so @@ -2103,7 +2105,8 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, tupdesc = RelationGetDescr(rootrel->ri_RelationDesc); /* a reverse map */ map = build_attrmap_by_name_if_req(old_tupdesc, - tupdesc); + tupdesc, + false); /* * Partition-specific slot's tupdesc can't be changed, -- cgit v1.2.3