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 1nX9cB-0006N1-3N for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 22:38:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nX9c9-0005Pt-VX for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 22:38:01 +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 1nX9c8-0005M8-V7 for pgsql-hackers@lists.postgresql.org; Wed, 23 Mar 2022 22:38:01 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nX9c4-0007GP-NB for pgsql-hackers@postgresql.org; Wed, 23 Mar 2022 22:38:00 +0000 Received: by mail-ed1-x532.google.com with SMTP id g20so3567353edw.6 for ; Wed, 23 Mar 2022 15:37:56 -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=kL53MyykGcSwQwqUt5Ld2Lg/GGTzRe3Jw/KRaJ/9R7I=; b=h8b8yL+LprMR2WAjjR8rWGjkzcS/wQem0s58amv5QvexNZjFr48Op1ZrPOaG8C8TJp DykArCBHiXx8144gqhTX47FRYkUyMJWR4unnFBY46w8+LGr0xh+MleGgIvgbOgLEwaqx Bt9v4ZVf1cTkkcrIGjz6ckWKnDc62IfnvkOllnVRR6ci8qSBSeuZ+LgN+OAOcxfBXZs3 H/WLfDfs8JebewvDsOHTElsSRnG4XdGufZ6VMDfLVHuD91oG+XAHTiAD/QCc/9ZH8s4b 2ELedVbAwqut2VuO50l2yEjOI+IPk/bEn9+0OtOcy2i5uIcisKcmK88rkagYSJyGcfEw 1FXQ== 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=kL53MyykGcSwQwqUt5Ld2Lg/GGTzRe3Jw/KRaJ/9R7I=; b=NFrCGvtVD8DupBHGHK8yHNofIHsannaP20GLPGv+StF0yLtbH6atX9HzitnSoVKGMd +z3nLs0vPtkfewJPxeI66JrRVDnu4ZZIuZ+YeiODe6ecyAb622DWVJlxQKZf0aqJPw6j X0faghJtlri4PLiHE2/qb3LsWFyAQLUOWyunECsus1FTD9Tme3NoMVgH0nk0xmB18PgS BpTKUG1GEMSg+yGmwQHbcSavVhiXcs5RYIEF5A/gS+UBR8bKrWHR5Ir5mzLg8xlMU2cj Uanw0yvfCAoij3/Yla2L2hhHGIMNn2bFHencUAv7dAL22jTdGHaLkLAEoWDcsbMxBC2Y 1lvw== X-Gm-Message-State: AOAM531myx9dlOxpLQi2GXYJnTEBhtI6y3WcAsPA+tVFfuPX8zHj2u+s UagO/20SiIi0avlJLHPxOEkcsVW86cEd0C0XFJ7W8AMp/sTgPsxHWr/F2jVIuCXzmEHKRiGzUm7 /veV0LvXv5a6e/tKBQcU1SyvvMGjxon78evmCrPUjaKF4fYvFt1ayrDwgf3IGKTp9O2ge6N4pHs gPS1648dWx6EuPyXnvTFgsrvmY9bxASinAWI6K X-Google-Smtp-Source: ABdhPJwpCA5PTfttT74cyvKQTTYUJwcuQhTQcoxmucrKoD5Kx6/EBknhhRoNATGiLwLAISFX1nzL2g== X-Received: by 2002:a05:6402:274e:b0:419:81a1:ed9b with SMTP id z14-20020a056402274e00b0041981a1ed9bmr3110541edd.9.1648075075614; Wed, 23 Mar 2022 15:37:55 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id s6-20020a170906778600b006dfc5be1ce0sm418444ejm.146.2022.03.23.15.37.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Mar 2022 15:37:55 -0700 (PDT) Message-ID: <563aa06b-0def-eaea-08ee-f629512ba2b8@enterprisedb.com> Date: Wed, 23 Mar 2022 23:37:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Column Filtering in Logical Replication Content-Language: en-US To: Amit Kapila Cc: "houzj.fnst@fujitsu.com" , Peter Eisentraut , Alvaro Herrera , Justin Pryzby , Rahila Syed , Peter Smith , pgsql-hackers , "shiy.fnst@fujitsu.com" References: <202201120041.p24wvsfcsope@alvherre.pgsql> <78b8d385-57cb-9a3f-cfe5-9f300f15eced@enterprisedb.com> <822a8e40-287c-59ff-0ea9-35eb759f4fe6@enterprisedb.com> <2b8471f9-3849-c91f-ef82-9181d4bca0a7@enterprisedb.com> <16e83ce3-8415-b732-37b2-c3329a2c13a1@enterprisedb.com> <3162f7f0-86ac-e3a9-dc55-0a660cb9bab1@enterprisedb.com> 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 3/21/22 12:55, Amit Kapila wrote: > On Sat, Mar 19, 2022 at 3:56 AM Tomas Vondra > wrote: >> >> ... >> >> However, while looking at how pgoutput, I realized one thing - for row >> filters we track them "per operation", depending on which operations are >> defined for a given publication. Shouldn't we do the same thing for >> column lists, really? >> >> I mean, if there are two publications with different column lists, one >> for inserts and the other one for updates, isn't it wrong to merge these >> two column lists? >> > > The reason we can't combine row filters for inserts with > updates/deletes is that if inserts have some column that is not > present in RI then during update filtering (for old tuple) it will > give an error as the column won't be present in WAL log. > > OTOH, the same problem won't be there for the column list/filter patch > because all the RI columns are there in the column list (for > update/delete) and we don't need to apply a column filter for old > tuples in either update or delete. > > Basically, the filter rules are slightly different for row filters and > column lists, so we need them (combine of filters) for one but not for > the other. Now, for the sake of consistency with row filters, we can > do it but as such there won't be any problem or maybe we can just add > a comment for the same in code. > OK, thanks for the explanation. I'll add a comment explaining this to the function initializing the column filter. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company