pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.
Date: Thu, 14 Jan 2021 21:19:57 +0000
Message-ID: <E1l0A29-0001Is-9a@gemulon.postgresql.org> (raw)

pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.

This is the same fix as commit 9eabfe300 applied to INDEX ATTACH
entries, but for table-to-publication attachments.  As in that
case, even though the backend doesn't record "ownership" of the
attachment, we still ought to label it in the dump archive with
the role name that should run the ALTER PUBLICATION command.
The existing behavior causes the ALTER to be done by the original
role that started the restore; that will usually work fine, but
there may be corner cases where it fails.

The bulk of the patch is concerned with changing struct
PublicationRelInfo to include a pointer to the associated
PublicationInfo object, so that we can get the owner's name
out of that when the time comes.  While at it, I rewrote
getPublicationTables() to do just one query of pg_publication_rel,
not one per table.

Back-patch to v10 where this code was introduced.

Discussion: https://postgr.es/m/1165710.1610473242@sss.pgh.pa.us

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1c9791f66cef61c07c1c9d959515981140362b01

Modified Files
--------------
src/bin/pg_dump/common.c  |  18 ++++++-
src/bin/pg_dump/pg_dump.c | 126 ++++++++++++++++++++++++----------------------
src/bin/pg_dump/pg_dump.h |   6 ++-
3 files changed, 87 insertions(+), 63 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1l0A29-0001Is-9a@gemulon.postgresql.org>
Permalink:  ../E1l0A29-0001Is-9a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1l0A29-0001Is-9a@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: pg_dump: label PUBLICATION TABLE ArchiveEntries with an owner.
  In-Reply-To: <E1l0A29-0001Is-9a@gemulon.postgresql.org>
  References: <E1l0A29-0001Is-9a@gemulon.postgresql.org>

* 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