From: Euler Taveira <euler@eulerto.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kong Man <kong_mansatiansin@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: pg_restore 14 skips ACL COLUMN when --schema is used
Date: Tue, 08 Aug 2023 22:31:57 -0300
Message-ID: <ece8667d-9824-4740-a150-617c9b3d9284@app.fastmail.com> (raw)
In-Reply-To: <82fd2945-f56f-4e78-b0b5-222848ba8241@app.fastmail.com>
References: <DM4PR11MB73976902DBBA10B1D652F9498B06A@DM4PR11MB7397.namprd11.prod.outlook.com>
<2427882.1690590240@sss.pgh.pa.us>
<DM4PR11MB7397E0F1BFD8A839199B59838B05A@DM4PR11MB7397.namprd11.prod.outlook.com>
<DM4PR11MB73970D090F35B7E1C2EEEB108B05A@DM4PR11MB7397.namprd11.prod.outlook.com>
<90659bbc-e0cb-407d-b42b-5931346735ad@app.fastmail.com>
<3317367.1691006807@sss.pgh.pa.us>
<82fd2945-f56f-4e78-b0b5-222848ba8241@app.fastmail.com>
On Wed, Aug 2, 2023, at 5:53 PM, Euler Taveira wrote:
> On Wed, Aug 2, 2023, at 5:06 PM, Tom Lane wrote:
>> Yeah, ignoring dependencies on ACLs in this logic seems like the best
>> way forward. Do you want to write a patch?
>
> I like your suggestion. Let me give it a try.
This patch should apply on all supported back branches (11-16).
In my previous email I forgot the --schema option in the pg_restore. The
correct steps are:
pg_dump -Fc -f /u/d.dump -d test
pg_restore -l /u/d.dump > /u/d.toc
pg_restore --schema=public --use-list=<(grep "ACL" /u/d.toc) -f - /u/d.dump
--
Euler Taveira
EDB https://www.enterprisedb.com/Attachments:v1-0001-Fix-column-level-ACL-for-selective-restore.patch (text/x-patch, 1.5K) download
From 3a99d2017b6a7774b15f55201ce64c74934caa7a Mon Sep 17 00:00:00 2001
From: Euler Taveira <euler.taveira@enterprisedb.com>
Date: Wed, 2 Aug 2023 19:44:37 -0300
Subject: [PATCH v1] Fix column-level ACL for selective restore
pg_restore skips column-level ACL when using a selective restore. The
issue is that some objects are skipped if it has multiple dependencies.
It used to be true for column-level ACL (it depends only on table
object) but an extra dependency for table ACL was added by commit
ea9125304d . Hence, it cannot rely on the number of dependencies (added
in commit 0d4e6ed3085) for this case. Ignore dependencies on ACLs
for selective restore.
Discussion: https://postgr.es/m/DM4PR11MB73976902DBBA10B1D652F9498B06A%40DM4PR11MB7397.namprd11.prod.outlook.com
---
src/bin/pg_dump/pg_backup_archiver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.cindex 39ebcfec32..2a25defe88 100644--- a/src/bin/pg_dump/pg_backup_archiver.c+++ b/src/bin/pg_dump/pg_backup_archiver.c@@ -2891,6 +2891,10 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH)
ropt->schemaExcludeNames.head != NULL ||
ropt->selTypes)
{
+ /* Ignore dependencies on ACL. */+ if (strcmp(te->desc, "ACL") == 0)+ return REQ_SCHEMA;+
/*
* In a selective dump/restore, we want to restore these dependent
* TOC entry types only if their parent object is being restored.
--
2.30.2
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: euler@eulerto.com, tgl@sss.pgh.pa.us, kong_mansatiansin@hotmail.com
Subject: Re: pg_restore 14 skips ACL COLUMN when --schema is used
In-Reply-To: <ece8667d-9824-4740-a150-617c9b3d9284@app.fastmail.com>
References: <DM4PR11MB73976902DBBA10B1D652F9498B06A@DM4PR11MB7397.namprd11.prod.outlook.com> <2427882.1690590240@sss.pgh.pa.us> <DM4PR11MB7397E0F1BFD8A839199B59838B05A@DM4PR11MB7397.namprd11.prod.outlook.com> <DM4PR11MB73970D090F35B7E1C2EEEB108B05A@DM4PR11MB7397.namprd11.prod.outlook.com> <90659bbc-e0cb-407d-b42b-5931346735ad@app.fastmail.com> <3317367.1691006807@sss.pgh.pa.us> <82fd2945-f56f-4e78-b0b5-222848ba8241@app.fastmail.com> <ece8667d-9824-4740-a150-617c9b3d9284@app.fastmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox