Re: Logical replication without a Primary Key

2017-12-18 Thread Petr Jelinek
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

Re: Logical replication without a Primary Key

2017-12-18 Thread Joshua D. Drake
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

Re: Logical replication without a Primary Key

2017-12-18 Thread Andres Freund
On 2017-12-18 12:43:24 -0800, Joshua D. Drake wrote: > This is the behavior I was expecting. As I said, I may have misunderstood > the responses but it is acting as I would expect. Just ot make sure: You're saying there's no problem here, and that logical rep is behaving correctly, right? FWIW, I

Re: Logical replication without a Primary Key

2017-12-18 Thread Joshua D. Drake
On 12/07/2017 12:39 PM, Andres Freund wrote: Not a problem. If you updated both rows, then there's two cases: a) the update actually changed the column values. In which case the first per-row change that's replicated updates the first row, but the second one won't again find it as match

Re: Logical replication without a Primary Key

2017-12-07 Thread Petr Jelinek
On 07/12/17 21:19, Robert Haas wrote: > On Thu, Dec 7, 2017 at 2:53 PM, Chapman Flack wrote: >> On 12/07/2017 02:38 PM, Joshua D. Drake wrote: >>> AB C >>> foo,bar,baz >>> foo,bar,baz >>> >>> And then I say: >>> >>> UPDATE test set A = 1 where C = baz >>> >>> I have updated two rows because

Re: Logical replication without a Primary Key

2017-12-07 Thread Andres Freund
On 2017-12-07 11:38:51 -0800, Joshua D. Drake wrote: > On 12/07/2017 10:49 AM, Robert Haas wrote: > > On Thu, Dec 7, 2017 at 9:43 AM, Petr Jelinek > > wrote: > > > No it won't, it will update only one row, it does not try to find > > > multiple matching rows. > > Good, because that's exactly what

Re: Logical replication without a Primary Key

2017-12-07 Thread Robert Haas
On Thu, Dec 7, 2017 at 2:53 PM, Chapman Flack wrote: > On 12/07/2017 02:38 PM, Joshua D. Drake wrote: >> AB C >> foo,bar,baz >> foo,bar,baz >> >> And then I say: >> >> UPDATE test set A = 1 where C = baz >> >> I have updated two rows because there is no primary key to identify the >> differe

Re: Logical replication without a Primary Key

2017-12-07 Thread Chapman Flack
On 12/07/2017 02:38 PM, Joshua D. Drake wrote: > A    B   C > foo,bar,baz > foo,bar,baz > > And then I say: > > UPDATE test set A = 1 where C = baz > > I have updated two rows because there is no primary key to identify the > differences. Both of those rows should be updated and thus replicated

Re: Logical replication without a Primary Key

2017-12-07 Thread Joshua D. Drake
On 12/07/2017 10:49 AM, Robert Haas wrote: On Thu, Dec 7, 2017 at 9:43 AM, Petr Jelinek wrote: No it won't, it will update only one row, it does not try to find multiple matching rows. Good, because that's exactly what it should do. I mean, if you have on the master two tuples that are identi

Re: Logical replication without a Primary Key

2017-12-07 Thread Robert Haas
On Thu, Dec 7, 2017 at 9:43 AM, Petr Jelinek wrote: > No it won't, it will update only one row, it does not try to find > multiple matching rows. Good, because that's exactly what it should do. I mean, if you have on the master two tuples that are identical, and you update one of them, then the

Re: Logical replication without a Primary Key

2017-12-07 Thread Petr Jelinek
On 07/12/17 15:32, Joshua D. Drake wrote: > On 12/07/2017 05:30 AM, Peter Eisentraut wrote: >> >>> How does that work? Is it using one of the hidden columns on a row? >> It means that for example if an update record is produced, the entire >> row is included in the record as the key. > > Thanks Pe

Re: Logical replication without a Primary Key

2017-12-07 Thread David G. Johnston
On Thursday, December 7, 2017, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 12/6/17 19:03, Joshua D. Drake wrote: > > > > > How does that work? Is it using one of the hidden columns on a row? > > It means that for example if an update record is produced, the entire > row is inc

Re: Logical replication without a Primary Key

2017-12-07 Thread Craig Ringer
On 7 December 2017 at 22:32, Joshua D. Drake wrote: > > The confusion I have is what if we have two rows that are identical and > now that I think about it we would just update both rows, yes? That would > make sense because it would produce two updated rows. > > I expect so, but honestly, maybe

Re: Logical replication without a Primary Key

2017-12-07 Thread Joshua D. Drake
On 12/07/2017 05:30 AM, Peter Eisentraut wrote: How does that work? Is it using one of the hidden columns on a row? It means that for example if an update record is produced, the entire row is included in the record as the key. Thanks Peter, Craig also responded, The confusion I have is wha

Re: Logical replication without a Primary Key

2017-12-07 Thread Peter Eisentraut
On 12/6/17 19:03, Joshua D. Drake wrote: > -Hackers, > > In the docs it says: > > " > If the table does not have any suitable key, then it can be set to > replica identity“full”, which means the entire row becomes the key. > > " > > How does that work? Is it using one of the hidden columns on

Logical replication without a Primary Key

2017-12-06 Thread Joshua D. Drake
-Hackers, In the docs it says: " If the table does not have any suitable key, then it can be set to replica identity“full”, which means the entire row becomes the key. " How does that work? Is it using one of the hidden columns on a row? Thanks, JD -- Command Prompt, Inc. || http://the