]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Avoid unconditionally filling in missing values with NULL in pgoutput.
authorAmit Kapila <akapila@postgresql.org>
Mon, 27 Nov 2023 03:29:12 +0000 (08:59 +0530)
committerAmit Kapila <akapila@postgresql.org>
Mon, 27 Nov 2023 03:29:12 +0000 (08:59 +0530)
commitd7ca9209c9707703d6fd3bb7dc6d539803a72876
tree8c320055259ff945c141e7d889222a583d0b85ce
parent8984480b545dcd8d09d8b877d71d9eae0b3bcb92
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
src/backend/replication/pgoutput/pgoutput.c
src/test/subscription/t/100_bugs.pl