mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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
This commit is contained in:
@ -2346,10 +2346,18 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
|
||||
if (orig_tl != NULL)
|
||||
elog(ERROR, "UPDATE target count mismatch --- internal error");
|
||||
|
||||
/*
|
||||
* Record in extraUpdatedCols generated columns referencing updated base
|
||||
* columns.
|
||||
*/
|
||||
fill_extraUpdatedCols(target_rte, tupdesc);
|
||||
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/*
|
||||
* Record in extraUpdatedCols generated columns referencing updated base
|
||||
* columns.
|
||||
*/
|
||||
void
|
||||
fill_extraUpdatedCols(RangeTblEntry *target_rte, TupleDesc tupdesc)
|
||||
{
|
||||
if (tupdesc->constr &&
|
||||
tupdesc->constr->has_generated_stored)
|
||||
{
|
||||
@ -2371,8 +2379,6 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist)
|
||||
defval.adnum - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
}
|
||||
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user