RE: Data is copied twice when specifying both child and parent table in publication

From: "wangw(dot)fnst(at)fujitsu(dot)com" <wangw(dot)fnst(at)fujitsu(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: RE: Data is copied twice when specifying both child and parent table in publication
Date: 2022-04-25 01:23:42
Message-ID: OS3PR01MB6275D6232E6AE4918394A0909EF89@OS3PR01MB6275.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(dot)kapila16(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-04-25 01:27:22 Re: [Proposal] vacuumdb --schema only
Previous Message Michael Paquier 2022-04-25 01:17:16 Re: [PATCH] Add native windows on arm64 support