mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Avoid unconditionally filling in missing values with NULL in pgoutput.
52e4f0cd4
introduced a bug in pgoutput in which missing values in tuples
were incorrectly filled in with NULL. The problem was the use of
CreateTupleDescCopy where CreateTupleDescCopyConstr was required, as the
former drops the constraints in the tuple description (specifically, the
default value constraint) on the floor.
The bug could result in incorrectness when a table replicated via
`REPLICA IDENTITY FULL` underwent a schema change that added a column
with a default value. The problem is that in such cases updates fill NULL
values in old tuples for missing columns for default values. Then on the
subscriber, we failed to find a matching tuple and missed updating the
required row.
Author: Nikhil Benesch
Reviewed-by: Hou Zhijie, Amit Kapila
Backpatch-through: 15
Discussion: http://postgr.es/m/CAPWqQZTEpZQamYsGMn6ZDRvVywwpVPiKH6OY4KSgA+NmeqFNzA@mail.gmail.com
This commit is contained in:
@ -1136,8 +1136,8 @@ init_tuple_slot(PGOutputData *data, Relation relation,
|
||||
* Create tuple table slots. Create a copy of the TupleDesc as it needs to
|
||||
* live as long as the cache remains.
|
||||
*/
|
||||
oldtupdesc = CreateTupleDescCopy(RelationGetDescr(relation));
|
||||
newtupdesc = CreateTupleDescCopy(RelationGetDescr(relation));
|
||||
oldtupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
|
||||
newtupdesc = CreateTupleDescCopyConstr(RelationGetDescr(relation));
|
||||
|
||||
entry->old_slot = MakeSingleTupleTableSlot(oldtupdesc, &TTSOpsHeapTuple);
|
||||
entry->new_slot = MakeSingleTupleTableSlot(newtupdesc, &TTSOpsHeapTuple);
|
||||
|
Reference in New Issue
Block a user