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 1mUqlv-0003Ub-1e for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Sep 2021 13:34:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mUqlt-0007Kt-Vy for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Sep 2021 13:34:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mUqlt-0007Kj-CU for pgsql-hackers@lists.postgresql.org; Mon, 27 Sep 2021 13:34:17 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mUqlp-0003G4-KQ for pgsql-hackers@lists.postgresql.org; Mon, 27 Sep 2021 13:34:16 +0000 Received: by mail-ed1-x535.google.com with SMTP id dj4so69589192edb.5 for ; Mon, 27 Sep 2021 06:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SJ6ryr0WIsFzJrUuisafVgls4qwRyTqMAlaz80TcaAk=; b=iBezXI1HhGuX071/3TxQ3aWWrcvoPrlmChKwLm+SX0Gxdic6rUfxjvz2sTe20ee8tc iO7QNvYqKOZ9WlrxUuq3OHFY2OPQ0+DXbNZ8RRF3a9VCxbh7764DwyFCTucNpammWDOQ nkzbNqbNe+T3UXUEroHlbojFQEP8PxSX1FA3LKRQhDfLxvLuENenujtK0e0px30I2O9E 8eZIfIk2OHSXm1N0LCQ91lvvGxsO4AmY/BeFCdCWHPLRgr5Bl89e0GrhGJi2qe0CEcid w0MGMMuGxVVT6pPV4yrew/2I1NpoWXaDMUrhs4SpL2lQlpEySvTN6yzhddiA2RQg8U1T nteg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SJ6ryr0WIsFzJrUuisafVgls4qwRyTqMAlaz80TcaAk=; b=fjklfNwZnuWzv8c4eh9Y2lQV7x0OGRbj0BkOs9DLkSjgXytOqBBP6/lUXTf4C1ltXL /+yTsuvS5xTD176FfzFHuFDEA6VdTEu5/gcMYDCr6xr1PUwSHx48VjDWoa1FCa8BXz4K S0AOzYnduayBUQ885Hk0gLHBnaVECR2unb+0zxPx9Wzgxt5opMP3EUWKAZ+t/7Nia92P 6pJArkEDxjlO/c1JG1YFD7j/RFv+8ISOQ6KhLIXAbJvo7Mgme+6513YkZ32scUelIyt7 oJwOAvoBBmR5KEEEe11fHoPyzxy8R5DqeQOwYUw+5JRcBiBONu4iJaBMoVPM1bLyGgcT WZcQ== X-Gm-Message-State: AOAM5324HcWYQrzRb7HWwX7Ysv7hqJcfqioFylAxSgR3b0DQh2VSr20C XGjYt9OmXE7zyZuZAOAIsB5Jc3Khf3JglILluDpMxyzyaWPP27hHnjV0tnm6CgmkTbqneKzklUf NOEmzXF1ixiCQYULFLfqDbRfG9NsPLMSN1WuEPYLmIbIAIRPWQPaENNCulst1daTksHtqZIItTZ y3q8eMOdrLGJn8Z/9kbj/p57guhMTVZd6b46QHxJld7gPdR6yrvxoz3hnxGvUbtWL4IBFhbt7ME 92qu0e1Q131MrJDDa+1PQkcVRb9aV/AVc7795U+EI6D22qBqfFpfg== X-Google-Smtp-Source: ABdhPJzzghjhysuh8IYuUmLiIy5tJ8pWispyFNLYXUONWkEaf9hTbrqd1ukltqLM51po0qZntjzvaA== X-Received: by 2002:a17:906:f75b:: with SMTP id jp27mr6816ejb.479.1632749651617; Mon, 27 Sep 2021 06:34:11 -0700 (PDT) Received: from [10.137.0.18] (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id j16sm2752108edw.23.2021.09.27.06.34.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 06:34:11 -0700 (PDT) Subject: Re: row filtering for logical replication To: Ajin Cherian , Euler Taveira Cc: Peter Smith , Amit Kapila , Rahila Syed , Peter Eisentraut , =?UTF-8?B?w5ZuZGVyIEthbGFjxLE=?= , japin , Michael Paquier , David Steele , Craig Ringer , Tomas Vondra , Amit Langote , PostgreSQL Hackers References: <0c2464d4-65f4-4d91-aeb2-c5584c1350f5@www.fastmail.com> <574b4e78-2f35-acf3-4bdc-4b872582e739@enterprisedb.com> From: Tomas Vondra Message-ID: <2e1f3505-6533-f642-37bc-e75c15cfcde4@enterprisedb.com> Date: Mon, 27 Sep 2021 15:34:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <574b4e78-2f35-acf3-4bdc-4b872582e739@enterprisedb.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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 Hi, I see no one responded to this important part of my review so far: On 9/23/21 2:33 PM, Tomas Vondra wrote: > 3) create_subscription.sgml > >     WHERE clauses, rows must satisfy all expressions >     to be copied. If the subscriber is a > > I'm rather skeptical about the principle that all expressions have to > match - I'd have expected exactly the opposite behavior, actually. > > I see a subscription as "a union of all publications". Imagine for > example you have a data set for all customers, and you create a > publication for different parts of the world, like > >   CREATE PUBLICATION customers_france >      FOR TABLE customers WHERE (country = 'France'); > >   CREATE PUBLICATION customers_germany >      FOR TABLE customers WHERE (country = 'Germany'); > >   CREATE PUBLICATION customers_usa >      FOR TABLE customers WHERE (country = 'USA'); > > and now you want to subscribe to multiple publications, because you want > to replicate data for multiple countries (e.g. you want EU countries). > But if you do > >   CREATE SUBSCRIPTION customers_eu >          PUBLICATION customers_france, customers_germany; > > then you won't get anything, because each customer belongs to just a > single country. Yes, I could create multiple individual subscriptions, > one for each country, but that's inefficient and may have a different > set of issues (e.g. keeping them in sync when a customer moves between > countries). > > I might have missed something, but I haven't found any explanation why > the requirement to satisfy all expressions is the right choice. > > IMHO this should be 'satisfies at least one expression' i.e. we should > connect the expressions by OR, not AND. Am I the only one finding the current behavior strange? What's the reasoning supporting the current approach? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company