diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-07-17 21:56:31 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-07-17 21:56:31 -0400 |
commit | c85ec643ff2586e2d144374f51f93bfa215088a2 (patch) | |
tree | 09f1bf11172c32055a4c6af76363f2a3d99b38c5 /src/backend/executor/execMain.c | |
parent | f81a91db4d1c2032632aa5df9fc14be24f5fe5ec (diff) | |
download | postgresql-c85ec643ff2586e2d144374f51f93bfa215088a2.tar.gz postgresql-c85ec643ff2586e2d144374f51f93bfa215088a2.zip |
Reverse-convert row types in ExecWithCheckOptions.
Just as we already do in ExecConstraints, and for the same reason:
to improve the quality of error messages.
Etsuro Fujita, reviewed by Amit Langote
Discussion: http://postgr.es/m/56e0baa8-e458-2bbb-7936-367f7d832e43@lab.ntt.co.jp
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index df9302896c0..b22de785167 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2097,6 +2097,25 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, * USING policy. */ case WCO_VIEW_CHECK: + /* See the comment in ExecConstraints(). */ + if (resultRelInfo->ri_PartitionRoot) + { + HeapTuple tuple = ExecFetchSlotTuple(slot); + TupleDesc old_tupdesc = RelationGetDescr(rel); + TupleConversionMap *map; + + rel = resultRelInfo->ri_PartitionRoot; + tupdesc = RelationGetDescr(rel); + /* a reverse map */ + map = convert_tuples_by_name(old_tupdesc, tupdesc, + gettext_noop("could not convert row type")); + if (map != NULL) + { + tuple = do_convert_tuple(tuple, map); + ExecStoreTuple(tuple, slot, InvalidBuffer, false); + } + } + insertedCols = GetInsertedColumns(resultRelInfo, estate); updatedCols = GetUpdatedColumns(resultRelInfo, estate); modifiedCols = bms_union(insertedCols, updatedCols); |