RE: Data is copied twice when specifying both child and parent table in publication
Wei Wang (Fujitsu) <wangw.fnst@fujitsu.com>
From: "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>
To: Amit Kapila <amit.kapila16@gmail.com>, "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Amit Langote <amitlangote09@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>, Greg Nancarrow <gregn4422@gmail.com>, vignesh C <vignesh21@gmail.com>
Date: 2022-04-25T01:23:42Z
Lists: pgsql-hackers
On Sun, Apr 24, 2022 at 2:16 PM I wrote: > On Thur, Apr 21, 2022 at 5:41 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > IIRC, the column list and row filter also have some issues exactly due to this > > reason, so, I would like those cases to be also mentioned here and probably > > include the tests for them in the patch for HEAD. > Improve the test case about the column list and row filter to cover this bug. Sorry, I forgot to explain why I modify the tests for row filter and column filter. If we specify different filters on the parent and child table respectively, this bug will make us use the wrong filter. Like the following cases: [row filter] - environment in publisher-side. create table t (a int) partition by range (a); create table t_1 partition of t default; create publication pub1 for table t where (a<=10) with (PUBLISH_VIA_PARTITION_ROOT=true); create publication pub2 for table t_1 where (a>10) with (PUBLISH_VIA_PARTITION_ROOT=true); insert into t values (9),(11); - environment in subscriber-side. create table t (a int) partition by range (a); create table t_1 partition of t default; create subscription sub connection 'dbname=postgres user=postgres' publication pub1,pub2; When we execute the following SQL in subscriber-side, what we expect should be: select * from t; a --- 9 (1 row) but the HEAD is: a ---- 9 11 (2 rows) [column filter] - environment in publisher-side. create table t (a int primary key, b int, c int) partition by range (a); create table t_1 partition of t default; create publication pub1 for table t(a, b) with (PUBLISH_VIA_PARTITION_ROOT=true); create publication pub2 for table t_1(a, c) with (PUBLISH_VIA_PARTITION_ROOT=true); insert into t values (1,1,1); - environment in subscriber-side. create table t (a int, b int, c int) partition by range (a); create table t_1 partition of t default; create subscription sub connection 'dbname=postgres user=postgres' publication pub1,pub2; When we execute the following SQL in subscriber-side, what we expect should be: select * from t; a | b | c ---+---+--- 1 | 1 | (1 row) but the HEAD is: a | b | c ---+---+--- 1 | 1 | 1 | | 1 (2 rows) Regards, Wang wei
Commits
-
Avoid syncing data twice for the 'publish_via_partition_root' option.
- 062a84442424 16.0 landed
-
Fix partition table's REPLICA IDENTITY checking on the subscriber.
- 52d5ea9adb01 14.5 cited
-
Prohibit combining publications with different column lists.
- fd0b9dcebda7 15.0 cited
-
Fix double publish of child table's data.
- 3f06c00cf6dc 13.6 landed
- 614b77d65a38 14.2 landed
- 5e97905a2c76 15.0 landed
-
Support adding partitioned tables to publication
- 17b9e7f9fe23 13.0 cited