Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe52fff

Browse files
author
Amit Kapila
committed
Ignore generated columns during apply of update/delete.
We fail to apply updates and deletes when the REPLICA IDENTITY FULL isused for the table having generated columns. We didn't use to ignoregenerated columns while doing tuple comparison among the tuples fromthe publisher and subscriber during apply of updates and deletes.Author: Onder KalaciReviewed-by: Shi yu, Amit KapilaBackpatch-through: 12Discussion:https://postgr.es/m/CACawEhVQC9WoofunvXg12aXtbqKnEgWxoRx3+v8q32AWYsdpGg@mail.gmail.com
1 parent4a1e9e7 commitbe52fff

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

‎src/backend/executor/execReplication.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,10 @@ tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2,
246246
att=TupleDescAttr(slot1->tts_tupleDescriptor,attrnum);
247247

248248
/*
249-
* Ignore dropped columns as the publisher doesn't send those
249+
* Ignore dropped and generated columns as the publisher doesn't send
250+
* those
250251
*/
251-
if (att->attisdropped)
252+
if (att->attisdropped||att->attgenerated)
252253
continue;
253254

254255
/*

‎src/test/subscription/t/100_bugs.pl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use warnings;
44
use PostgresNode;
55
use TestLib;
6-
use Test::Moretests=>8;
6+
use Test::Moretests=>9;
77

88
# Bug #15114
99

@@ -228,8 +228,8 @@
228228
$node_publisher->stop('fast');
229229
$node_subscriber->stop('fast');
230230

231-
# The bug was that when the REPLICA IDENTITY FULL is used with droppedcolumns,
232-
# we fail to apply updates and deletes
231+
# The bug was that when the REPLICA IDENTITY FULL is used with droppedor
232+
#generated columns,we fail to apply updates and deletes
233233
my$node_publisher_d_cols = get_new_node('node_publisher_d_cols');
234234
$node_publisher_d_cols->init(allows_streaming=>'logical');
235235
$node_publisher_d_cols->start;
@@ -242,14 +242,18 @@
242242
'postgres',qq(
243243
CREATE TABLE dropped_cols (a int, b_drop int, c int);
244244
ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
245-
CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols;
245+
CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int);
246+
ALTER TABLE generated_cols REPLICA IDENTITY FULL;
247+
CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols;
246248
-- some initial data
247249
INSERT INTO dropped_cols VALUES (1, 1, 1);
250+
INSERT INTO generated_cols (a, c) VALUES (1, 1);
248251
));
249252

250253
$node_subscriber_d_cols->safe_psql(
251254
'postgres',qq(
252255
CREATE TABLE dropped_cols (a int, b_drop int, c int);
256+
CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int);
253257
));
254258

255259
my$publisher_connstr_d_cols =
@@ -271,6 +275,7 @@
271275
$node_publisher_d_cols->safe_psql(
272276
'postgres',qq(
273277
UPDATE dropped_cols SET a = 100;
278+
UPDATE generated_cols SET a = 100;
274279
));
275280
$node_publisher_d_cols->wait_for_catchup('sub_dropped_cols');
276281

@@ -279,5 +284,10 @@
279284
qq(1),
280285
'replication with RI FULL and dropped columns');
281286

287+
is($node_subscriber_d_cols->safe_psql(
288+
'postgres',"SELECT count(*) FROM generated_cols WHERE a = 100"),
289+
qq(1),
290+
'replication with RI FULL and generated columns');
291+
282292
$node_publisher_d_cols->stop('fast');
283293
$node_subscriber_d_cols->stop('fast');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp