Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlHZI-0000HQ-2w for pgsql-hackers@arkaria.postgresql.org; Sun, 01 May 2022 21:57:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nlHZG-0002wS-Ps for pgsql-hackers@arkaria.postgresql.org; Sun, 01 May 2022 21:57:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlHZG-0002wD-GZ for pgsql-hackers@lists.postgresql.org; Sun, 01 May 2022 21:57:26 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nlHZ9-0008V6-Fb for pgsql-hackers@lists.postgresql.org; Sun, 01 May 2022 21:57:25 +0000 Received: by mail-ej1-x630.google.com with SMTP id kq17so24754320ejb.4 for ; Sun, 01 May 2022 14:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=WZ5PXyT50zlq5ZrmrhfccFgG31KL53S3Xjta66wFTaA=; b=DOkAqp52nFeopSR7uYuDnwCrOYn8z5bs2T1AXteYhvB5pNW6WjrSwNAwlHAZWqPhb8 BWwVE5Zse9IURSaKlCDfXitKAHPthzHl66tTACtIgch6gWv6mC+GSF/yT0SsWy/7PXyF GfNdinjFYT9+z3a4uF2cdnU34XXqYO0xbpDgUKZhQbBirZ19l+EjGDEBKccxF1WHIYaZ d2FO7d/06ebVkQYo6aZJkTcy+XxQev/XD651YKpH6ys+yQfWQ/QGynYzluQDhsVkVjn8 FFmmrcxFONhGVUy7ySFkUtaIqmNFf3nE4R0aazNT8/JDaWLZSx2rJn4+3XxGGNwcomH7 4GoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=WZ5PXyT50zlq5ZrmrhfccFgG31KL53S3Xjta66wFTaA=; b=huvkLGJqLXEY/jtWc94+J5g9rUW2iYV9RRFBukT/94B312diSi7RJhfEniKgTIcfxn NtaoSgbWdaDSLt+X3xSTFyZeCS1aGdyXwc3AwSzOZz+cf5BJIq3kEKCKZwWErkv2Y2jM R+v+TzqM51T8IlSnmS2YaERC4eENqvNS8EtEHKDU0RiiD0+QZAjxcbPP5LCWJzPuwEo/ DZ/Jbmi4APS8401wZVD/I1c+WKHIBPqJ5JnioUbIs5uZLTQWdM3IDX7OU2vRatpUE2p0 AvfTs/F+vqq2JAH4aHNluLhogB6ma3p/urezIZkFqZ2ezlUqo2JFtwtf1NkrQG52e7JA U2qg== X-Gm-Message-State: AOAM531ycL4O32f5lE0E0yDPO2C/I31Yo7E3nIHZg+lKIId88m61C3X2 YCk1O1Q+5S1gYcKdxG1oXuq0t81blvMf0ItSSesq6xGPqFI/jeBRWapAsTEue8xte53uUTZSlTe sDb/pIbqqIOQIjrpxW/iELKEwpxppayGbup+2ozJOsrQV+4tDD7iioeXcGnnzLdsYc8lQqc6IBz IhaXubHRWJC+JHIC2VR8ndE0kGRwJ4DqKUmCj8Lv9N2993hYkv15SerQgM9U4O X-Google-Smtp-Source: ABdhPJw/FrlF7XfjzZKXm8Fm2czI4+TgPu8K35zSVuZpCJww6WhDBKym0p0VnVAPcComi3zv1yKfPA== X-Received: by 2002:a17:907:1ca2:b0:6f0:2798:83e7 with SMTP id nb34-20020a1709071ca200b006f0279883e7mr8931667ejc.85.1651442237249; Sun, 01 May 2022 14:57:17 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-250-165.net.upcbroadband.cz. [86.49.250.165]) by smtp.gmail.com with ESMTPSA id ig11-20020a1709072e0b00b006f3ef214e2esm3020502ejc.148.2022.05.01.14.57.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 May 2022 14:57:16 -0700 (PDT) Message-ID: Date: Sun, 1 May 2022 23:57:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: bogus: logical replication rows/cols combinations Content-Language: en-US To: Amit Kapila , Alvaro Herrera Cc: Peter Eisentraut , Pg Hackers References: <202204300931.um766ighsghq@alvherre.pgsql> From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/30/22 12:11, Amit Kapila wrote: > On Sat, Apr 30, 2022 at 3:01 PM Alvaro Herrera wrote: >> >> On 2022-Apr-30, Amit Kapila wrote: >> >>> On Sat, Apr 30, 2022 at 2:02 AM Tomas Vondra >>> wrote: >> >>>> That seems to deal with a circular replication, i.e. two logical >>>> replication links - a bit like a multi-master. Not sure how is that >>>> related to the issue we're discussing here? >>> >>> It is not directly related to what we are discussing here but I was >>> trying to emphasize the point that users need to define the logical >>> replication via pub/sub sanely otherwise they might see some weird >>> behaviors like that. >> >> I agree with that. >> >> My proposal is that if users want to define multiple publications, and >> their definitions conflict in a way that would behave ridiculously (== >> bound to cause data inconsistencies eventually), an error should be >> thrown. Maybe we will not be able to catch all bogus cases, but we can >> be prepared for the most obvious ones, and patch later when we find >> others. >> > > I agree with throwing errors for obvious/known bogus cases but do we > want to throw errors or restrict the combining of column lists when > row filters are present in all cases? See some examples [1 ] where it > may be valid to combine them. > I think there are three challenges: (a) Deciding what's an obvious bug or an unsupported case (e.g. because it's not clear what's the correct behavior / way to merge column lists). (b) When / where to detect the issue. (c) Making sure this does not break/prevent existing use cases. As I said before [1], I think the issue stems from essentially allowing DML to have different row filters / column lists. So we could forbid publications to specify WITH (publish=...) and one of the two features, or make sure subscription does not combine multiple such publications. The second option has the annoying consequence that it makes this useless for the "data redaction" use case I described in [2], because that relies on combining multiple publications. Furthermore, what if the publications change after the subscriptions get created? Will we be able to detect the error etc.? So I'd prefer the first option, but maybe that prevents some useful use cases too ... regards [1] https://www.postgresql.org/message-id/45d27a8a-7c7a-88e8-a3db-c7c1d144df5e%40enterprisedb.com [2] https://www.postgresql.org/message-id/338e719c-4bc8-f40a-f701-e29543a264e4%40enterprisedb.com -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company