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

Commit0f2d4ad

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 parent488ace3 commit0f2d4ad

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
@@ -245,9 +245,10 @@ tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2)
245245
att=TupleDescAttr(slot1->tts_tupleDescriptor,attrnum);
246246

247247
/*
248-
* Ignore dropped columns as the publisher doesn't send those
248+
* Ignore dropped and generated columns as the publisher doesn't send
249+
* those
249250
*/
250-
if (att->attisdropped)
251+
if (att->attisdropped||att->attgenerated)
251252
continue;
252253

253254
/*

‎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=>6;
6+
use Test::Moretests=>7;
77

88
# Bug #15114
99

@@ -180,8 +180,8 @@
180180
$node_publisher->stop('fast');
181181
$node_subscriber->stop('fast');
182182

183-
# The bug was that when the REPLICA IDENTITY FULL is used with droppedcolumns,
184-
# we fail to apply updates and deletes
183+
# The bug was that when the REPLICA IDENTITY FULL is used with droppedor
184+
#generated columns,we fail to apply updates and deletes
185185
my$node_publisher_d_cols = get_new_node('node_publisher_d_cols');
186186
$node_publisher_d_cols->init(allows_streaming=>'logical');
187187
$node_publisher_d_cols->start;
@@ -194,14 +194,18 @@
194194
'postgres',qq(
195195
CREATE TABLE dropped_cols (a int, b_drop int, c int);
196196
ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
197-
CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols;
197+
CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int);
198+
ALTER TABLE generated_cols REPLICA IDENTITY FULL;
199+
CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols;
198200
-- some initial data
199201
INSERT INTO dropped_cols VALUES (1, 1, 1);
202+
INSERT INTO generated_cols (a, c) VALUES (1, 1);
200203
));
201204

202205
$node_subscriber_d_cols->safe_psql(
203206
'postgres',qq(
204207
CREATE TABLE dropped_cols (a int, b_drop int, c int);
208+
CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int);
205209
));
206210

207211
my$publisher_connstr_d_cols =
@@ -224,6 +228,7 @@
224228
$node_publisher_d_cols->safe_psql(
225229
'postgres',qq(
226230
UPDATE dropped_cols SET a = 100;
231+
UPDATE generated_cols SET a = 100;
227232
));
228233
$node_publisher_d_cols->wait_for_catchup('sub_dropped_cols');
229234

@@ -232,5 +237,10 @@
232237
qq(1),
233238
'replication with RI FULL and dropped columns');
234239

240+
is($node_subscriber_d_cols->safe_psql(
241+
'postgres',"SELECT count(*) FROM generated_cols WHERE a = 100"),
242+
qq(1),
243+
'replication with RI FULL and generated columns');
244+
235245
$node_publisher_d_cols->stop('fast');
236246
$node_subscriber_d_cols->stop('fast');

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp