Re: row filtering for logical replication

From: Euler Taveira <euler(at)timbira(dot)com(dot)br>
To: movead li <movead(dot)li(at)highgo(dot)ca>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: row filtering for logical replication
Date: 2019-09-25 11:08:40
Message-ID: CAHE3wgiQFNwwXdbtNCKKdvh+HZ-QDTnzSBqQXtZkPV8hVRssaQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em seg, 23 de set de 2019 às 01:59, movead li <movead(dot)li(at)highgo(dot)ca> escreveu:
>
> I find several problems as below when I test the patches:
>
First of all, thanks for your review.

> 1. There be some regression problem after apply 0001.patch~0005.patch
> The regression problem is solved in 0006.patch
>
Which regression?

> 2. There be a data wrong after create subscription if the relation contains
> inherits table, for example:
>
Ouch. Good catch! Forgot about the ONLY in COPY with query. I will add
a test for it.

> 3. I am puzzled when I test the update.
> Use the tables in problem 2 and test as below:
> #########################
> On publication:
> postgres=# insert into cities values('t1',123, 34);
> INSERT 0 1
>
INSERT isn't replicated.

> postgres=# update cities SET altitude = 134 where altitude = 34;
> UPDATE 1
>
There should be an error because you don't have a PK or REPLICA IDENTITY.

postgres=# update cities SET altitude = 134 where altitude = 34;
ERROR: cannot update table "cities" because it does not have a
replica identity and publishes updates
HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE.

Even if you create a PK or REPLICA IDENTITY, it won't turn this UPDATE
into a INSERT and send it to the other node (indeed UPDATE will be
sent however there isn't a tuple to update). Also, filter columns must
be in PK or REPLICA IDENTITY. I explain this in documentation.

> 4. SQL splicing code in fetch_remote_table_info() function is too long
>
I split it into small pieces. I also run pgindent to improve code style.

I'll send a patchset later today.

Regards,

--
Euler Taveira Timbira -
http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2019-09-25 11:09:47 Re: Zedstore - compressed in-core columnar storage
Previous Message Jonathan S. Katz 2019-09-25 11:08:23 Re: PostgreSQL 12 RC1 Press Release Draft