Re: Logical replication without a Primary Key

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical replication without a Primary Key
Date: 2017-12-18 21:23:12
Message-ID: 80dc1847-0c51-44f0-5d1c-60b93a745df8@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 18/12/17 21:57, Joshua D. Drake wrote:
> On 12/18/2017 12:52 PM, Andres Freund wrote:
>>
>> Just ot make sure: You're saying there's no problem here, and that
>> logical rep is behaving correctly, right?
>
> Correct. I am not sure where the miscommunication was (fully willing to
> accept it was on my side) but if I update multiple rows in a single
> statement, all the rows that were modified get replicated. That is the
> behavior I would have expected.
>

I think it's because we said if you update single row on upstream which
may be confusing in case of multiple rows. It will update single row on
downstream even though there is 4 same rows on downstream. That's still
true. In your test however you have 4 same rows on downstream but you
also have same 4 rows on upstream which you all updated. So you got 4
row updates which were replicated and each of those 4 updates changed
one row.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2017-12-18 21:29:38 Re: BUG #14941: Vacuum crashes
Previous Message Joshua D. Drake 2017-12-18 20:57:02 Re: Logical replication without a Primary Key