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 1nmx2b-0002Vx-Un for pgsql-hackers@arkaria.postgresql.org; Fri, 06 May 2022 12:26:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nmx2a-0006Aq-BS for pgsql-hackers@arkaria.postgresql.org; Fri, 06 May 2022 12:26:36 +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 1nmx2Z-0006Ah-KL for pgsql-hackers@lists.postgresql.org; Fri, 06 May 2022 12:26:36 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nmx2U-0001NM-HR for pgsql-hackers@lists.postgresql.org; Fri, 06 May 2022 12:26:34 +0000 Received: by mail-wm1-x32d.google.com with SMTP id i67-20020a1c3b46000000b003946c466c17so334162wma.4 for ; Fri, 06 May 2022 05:26:30 -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=SKWTHz/irbnfW4hqcMS5VCat/8CWUjbd7wD4sYRUxWo=; b=mc74hhGWIcLOyvlnAy45ATOi8Ok+zVEZwC+pNMbfV9aOJw+BCPKYQzXmfmpOKwJPTT koipiCig4VkVJjSOc+r+ig8sK0crhdo5r1hKk8gUJBPKjSg2A2PUWSAggdMHs5gyqDQ4 7MPMhiyh75/EomUnFaLJFH7175isQabiwUUV7m+PIDudV6Bm2PTGE+GDqu/3QrhSzdXw ZIKb7NXkjzLOlv47oQEjj6MxUqSpllNDajKnzBfTiXdbRk6ytqOaUI1cm97uvRhYMED+ 1F+PFeacc6lERzlsSEYx1LXY0gvQPONi7OyWowIR97/TzQ9oYIdilOrPd8I4bTaLpd7L aUiQ== 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=SKWTHz/irbnfW4hqcMS5VCat/8CWUjbd7wD4sYRUxWo=; b=qOlJuFkYU5aNkrfgAWd7/kTb5hJD+wixgTvvxTnv+UXA8/dPyJjPjstXM1jrHS3Xxl L1ez4nYBesWcAMhWawFZ6Cf1jjvxnnnutUarkJrJkV1xMRCuDd4l3b1tuLGNyOUqoWwN H+47xw8mp5bssADi+J0fIBoyOSKGCVOiU/xkKdG3aedyyxOlOjF6OzHL3BviRM+tv5I+ 9cPBlqluuP2ODrPh8LSC6PUeKcISFubey3vYzE6jX+nKsUa+YwlMTDal8NzxE+7PbRZc /j+FaQaha7rVFchID048EFDONzDRoLJXtmMpWwHGtIOvk3Yg3idg01lJ107v3hgc/cr5 m4Kw== X-Gm-Message-State: AOAM531V5hP8UuJndOW9KVObyQkoh0H98Jl7WBKkIFqp7TqniuO7gzRd Oq5QN2Ra6ZZ8tyA71eUx5hIylYbWHN/UoUCxwk87CzRhF3pRB1NgJJGBr0yFSUeIjsGPCe6j4sx 73TSKFUHprYzzj495mULcqLQEPQN4QoH02uyv/r+W++P5TJOtU3mcvQC9ON8QNN3UKorFMTFqoa gx0Up1Rn1/5Wexbe5smxRRizPkp+zZp4pfz62o8pRA4uihOwCExNfz X-Google-Smtp-Source: ABdhPJx0TEeMiNe/sktlM4dYgPZqN4zvvLq+GQzxuDKqesu0Srj2ZsDDECM1lWjnerwT4JQESclMLw== X-Received: by 2002:a05:600c:1293:b0:394:3940:2302 with SMTP id t19-20020a05600c129300b0039439402302mr3113758wmd.121.1651839988191; Fri, 06 May 2022 05:26:28 -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 t10-20020a05600c41ca00b003942a244ec0sm4449939wmh.5.2022.05.06.05.26.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 May 2022 05:26:27 -0700 (PDT) Message-ID: <527910b5-2530-1b60-5a08-4930b1bf8647@enterprisedb.com> Date: Fri, 6 May 2022 14:26:27 +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: "houzj.fnst@fujitsu.com" , Amit Kapila Cc: Alvaro Herrera , Peter Eisentraut , Pg Hackers References: <202205021751.aosyba2mh7bc@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 5/6/22 05:23, houzj.fnst@fujitsu.com wrote: > On Tuesday, May 3, 2022 11:31 AM Amit Kapila wrote: >> >> On Tue, May 3, 2022 at 12:10 AM Tomas Vondra >> wrote: >>> >>> On 5/2/22 19:51, Alvaro Herrera wrote: >>>>> Why would we need to know publications replicated by other >> walsenders? >>>>> And what if the subscriber is not connected at the moment? In that case >>>>> there'll be no walsender. >>>> >>>> Sure, if the replica is not connected then there's no issue -- as you >>>> say, that replica will fail at START_REPLICATION time. >>>> >>> >>> Right, I got confused a bit. >>> >>> Anyway, I think the main challenge is defining what exactly we want to >>> check, in order to ensure "sensible" behavior, without preventing way >>> too many sensible use cases. >>> >> >> I could think of below two options: >> 1. Forbid any case where column list is different for the same table >> when combining publications. >> 2. Forbid if the column list and row filters for a table are different >> in the set of publications we are planning to combine. This means we >> will allow combining column lists when row filters are not present or >> when column list is the same (we don't get anything additional by >> combining but the idea is we won't forbid such cases) and row filters >> are different. >> >> Now, I think the points in favor of (1) are that the main purpose of >> introducing a column list are: (a) the structure/schema of the >> subscriber is different from the publisher, (b) want to hide sensitive >> columns data. In both cases, it should be fine if we follow (1) and >> from Peter E.'s latest email [1] he also seems to be indicating the >> same. If we want to be slightly more relaxed then we can probably (2). >> We can decide on something else as well but I feel it should be such >> that it is easy to explain. > > I also think it makes sense to add a restriction like (1). I am planning to > implement the restriction if no one objects. > I'm not going to block that approach if that's the consensus here, though I'm not convinced. Let me point out (1) does *not* work for data redaction use case, certainly not the example Alvaro and me presented, because that relies on a combination of row filters and column filters. Requiring all column lists to be the same (and not specific to row filter) prevents that example from working. Yes, you can create multiple subscriptions, but that brings it's own set of challenges too. I doubt forcing users to use the more complex setup is good idea, and combining the column lists per [1] seems sound to me. That being said, the good thing is this restriction seems it might be relaxed in the future to work per [1], without causing any backwards compatibility issues. Should we do something similar for row filters, though? It seems quite weird we're so concerned about unexpected behavior due to combining column lists (despite having a patch that makes it behave sanely), and at the same time wave off similarly strange behavior due to combining row filters because "that's what you get if you define the publications in a strange way". regards [1] https://www.postgresql.org/message-id/5a85b8b7-fc1c-364b-5c62-0bb3e1e25824%40enterprisedb.com -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company