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 1oqsCo-0007aN-FU for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 08:37: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 1oqsCk-0001cb-Ko for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Nov 2022 08:37:34 +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 1oqsCk-0001cS-8X for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 08:37:34 +0000 Received: from mail-wm1-f54.google.com ([209.85.128.54]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oqsCg-0000G8-5W for pgsql-hackers@lists.postgresql.org; Fri, 04 Nov 2022 08:37:33 +0000 Received: by mail-wm1-f54.google.com with SMTP id m29-20020a05600c3b1d00b003c6bf423c71so4964728wms.0 for ; Fri, 04 Nov 2022 01:37:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=t0wIlytyYmqkDZznfamZphglnuV+rCJiSeNUMwwPPyM=; b=BvrZVgHWq6tQB/C+b5JykWEDnu0HNdTezIgbnVADpo2RN6jGP7AKpa4psP32RC4Lb4 bLc3qyuC6IJ4Ri20KhhTfMaM2r1Lot6a7z9gtXMxsiKFJPuBMh+GzOLO6C6//nd2AwPr LT9fsPCp/nsgy3h/Qr2dkoj/r9X058BPLWOc1YjPc8cSoD4ZmacJLssAYDKwavA7Qlhd 9vRbtEbXlZ1vhxl7SbWRLYo3bjHSgbYdJOBCbrd6kW90jsyIzi2EYjrXEQela0uj07Bj qEoKN7MYmXU1ICJZPssHbAzvqeuEwPRvUw0/jkNkas7gCpSIKja/hm26RSYp2ZyZLMYB lh4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t0wIlytyYmqkDZznfamZphglnuV+rCJiSeNUMwwPPyM=; b=JHVHZCIFCejdRWyc9pO/v7ICBhLsNL8ddsMZzutsWnF7RM97+bKY6uIHQNcCGVcT88 dF8LXniWd3iITmNXaKXbRy6bpWgf+9jb03LgvpSGZZ4GhAf/kTmOb+8yUqYq8Thf2+53 HoRUp22RykeHM0L3w8KiHobPBCORQYNhgxHqrcWupIOO8l+UI5BBX6u8ZcE52g4AVg9P xVsktRpD5zCNzMrWs8CR5quWimR/VZfwyhM8uXFYurgW3GEKKGuGBdoOKyfOkK810C1s TuZ5rgCGvJtQWY4l+PLsnjmlmrRMKaHjSN2URWUgOl1yc17zfcDM7xGWQstcfaRfGZ8K fOig== X-Gm-Message-State: ACrzQf1eCpTjhkGYeA/XPvg/FI/jQSxv83zi+9nEKxIAUpqfSjO9T24+ bgXCBgoSmhZkTZIbxhhdr2kUqg== X-Google-Smtp-Source: AMsMyM4lA1J+2sQEQmhzQFn/LzYw3khzYjaQapmH0iHd76oGFKz0ALNBgppEfQkxHMsn1x1VqlNWrQ== X-Received: by 2002:a1c:f008:0:b0:3b4:fd2e:3ede with SMTP id a8-20020a1cf008000000b003b4fd2e3edemr33191707wmb.133.1667550987629; Fri, 04 Nov 2022 01:36:27 -0700 (PDT) Received: from antos ([88.103.134.65]) by smtp.gmail.com with ESMTPSA id r8-20020adfa148000000b00236722ebe66sm2699893wrr.75.2022.11.04.01.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 01:36:26 -0700 (PDT) From: Antonin Houska To: Amit Kapila cc: Peter Eisentraut , Euler Taveira , PostgreSQL Hackers Subject: Re: Privileges on PUBLICATION In-reply-to: References: <20330.1652105397@antos> <8a00e0e1-dc4e-422c-9dcf-664b16b18625@www.fastmail.com> <2810.1652171844@antos> <5859.1652423797@antos> <57022.1652867097@antos> <4c420c17-8570-4b52-b7f6-9ce3f53d7ef9@www.fastmail.com> <14292.1655733695@antos.home> <746c9a65-e2cc-2573-a50e-ab5ea884f680@enterprisedb.com> <1537.1667454192@antos> Comments: In-reply-to Amit Kapila message dated "Fri, 04 Nov 2022 09:59:43 +0530." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 27.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2784.1667551049.1@antos> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Nov 2022 09:37:29 +0100 Message-ID: <2785.1667551049@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Kapila wrote: > On Thu, Nov 3, 2022 at 11:12 AM Antonin Houska wrote: > > > > Peter Eisentraut wrote: > > > > > The CF entry is about privileges on publications. Please rebase tha= t patch > > > and repost it so that the CF app and the CF bot are up to date. > > > > The rebased patch (with regression tests added) is attached here. > > > > There's still one design issue that I haven't mentioned yet: if the US= AGE > > privilege on a publication is revoked after the synchronization phase > > completed, the missing privilege on a publication causes ERROR in the = output > > plugin. If the privilege is then granted, the error does not disappear= because > > the same (historical) snapshot we use to decode the failed data change= again > > is also used to check the privileges in the catalog, so the output plu= gin does > > not see that the privilege has already been granted. > > > = > We have a similar problem even when publication is dropped/created. > The replication won't be able to proceed. > = > > The only solution seems to be to drop the publication from the subscri= ption > > and add it again, or to drop and re-create the whole subscription. I h= aven't > > added a note about this problem to the documentation yet, in case some= one has > > better idea how to approach the problem. > > > = > I think one possibility is that the user advances the slot used in > replication by using pg_replication_slot_advance() at or after the > location where the privilege is granted. Some other ideas have been > discussed in the thread [1], in particular, see email [2] and > discussion after that but we didn't reach any conclusion. Thanks for feedback. Regarding the publications, I'm not sure what the use= r should expect if he revokes the permissions in the middle of processing. I= n such a situation, he should be aware that some privileged data could alrea= dy have been replicated. My preference in such a situation would be to trunca= te the table(s) on the subscriber side and to restart the replication, rather than fix the replication and keep the subscriber's access to the leaked da= ta. > [1] - https://www.postgresql.org/message-id/CAHut%2BPvMbCsL8PAz1Qc6LNoL0= Ag0y3YJtPVJ8V0xVXJOPb%2B0xw%40mail.gmail.com > [2] - https://www.postgresql.org/message-id/CAA4eK1JTwOAniPua04o2EcOXfzR= a8ANax%3D3bpx4H-8dH7M2p%3DA%40mail.gmail.com -- = Antonin Houska Web: https://www.cybertec-postgresql.com