From: | Amit Kapila <akapila(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Avoid unconditionally filling in missing values with NULL in pgo |
Date: | 2023-11-27 03:49:56 |
Message-ID: | E1r7Sd9-007RnL-Rg@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d7ca9209c9707703d6fd3bb7dc6d539803a72876
Modified Files
--------------
src/backend/replication/pgoutput/pgoutput.c | 4 +--
src/test/subscription/t/100_bugs.pl | 53 +++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2023-11-27 15:52:29 | pgsql: Reduce rate of walwriter wakeups due to async commits. |
Previous Message | Alexander Korotkov | 2023-11-27 00:52:53 | pgsql: Track statement entry timestamp in contrib/pg_stat_statements |