diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2020-02-17 15:19:58 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2020-02-17 15:21:12 +0100 |
commit | 4a97f647ddbc79af2fb91727d4a2502ce667d0fd (patch) | |
tree | a9ac774eacc424700ad620d634193f9b14232183 /src/backend/replication/logical/worker.c | |
parent | 0b54741815694cc97041c81e344aa9b3162e529e (diff) | |
download | postgresql-4a97f647ddbc79af2fb91727d4a2502ce667d0fd.tar.gz postgresql-4a97f647ddbc79af2fb91727d4a2502ce667d0fd.zip |
Fill in extraUpdatedCols in logical replication
The extraUpdatedCols field of the target RTE records which generated
columns are affected by an update. This is used in a variety of
places, including per-column triggers and foreign data wrappers. When
an update was initiated by a logical replication subscription, this
field was not filled in, so such an update would not affect generated
columns in a way that is consistent with normal updates. To fix,
factor out some code from analyze.c to fill in extraUpdatedCols in the
logical replication worker as well.
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/b05e781a-fa16-6b52-6738-761181204567@2ndquadrant.com
Diffstat (limited to 'src/backend/replication/logical/worker.c')
-rw-r--r-- | src/backend/replication/logical/worker.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index a0384126399..790a28fc77e 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -42,6 +42,7 @@ #include "miscadmin.h" #include "nodes/makefuncs.h" #include "optimizer/optimizer.h" +#include "parser/analyze.h" #include "parser/parse_relation.h" #include "pgstat.h" #include "postmaster/bgworker.h" @@ -736,6 +737,8 @@ apply_handle_update(StringInfo s) i + 1 - FirstLowInvalidHeapAttributeNumber); } + fill_extraUpdatedCols(target_rte, RelationGetDescr(rel->localrel)); + PushActiveSnapshot(GetTransactionSnapshot()); ExecOpenIndices(estate->es_result_relation_info, false); |