Re: Preserve conflict log table during upgrade

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Preserve conflict log table during upgrade
Date: 2026-11-27 06:19:06
Message-ID: CAA4eK1Jv8Y5_oC1ojs9hXvrF1F+gKbFBQeV4SUfoqVkX5yxf2Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 27, 2026 at 9:48 AM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
>
> 0002: Preserve conflict log tables and conflict_log_destination during upgrade
>

Few comments:
=============
*
---
Outside binary-upgrade mode, conflict log tables are recreated when
the subscription is restored, and nothing about them is dumped, unless
they are named explicitly.
---

Why are they dumped even when named explicitly? Do we dump any other
such internally generated table when named explicitly? We probably
need to disallow specifying it explicitly.

*
---
A conflict log table is dumped only along with its subscription. So it
is not dumped with --no-subscriptions, with -n, -t or -e, by a
non-superuser, or when the post-data section is not dumped, unless the
table is named explicitly with -t or -n.
---

I feel the second sentence (So it ..) seems unnecessary.

*
+ /*
+ * The table was restored by the user running the restore, but it
+ * must belong to the owner of the subscription. Usually the
+ * subscription is created by the same user, and the owner of both
+ * is then set later by ALTER SUBSCRIPTION ... OWNER TO. But when
+ * the dump uses SET SESSION AUTHORIZATION to set owners, the
+ * subscription is created by its owner and no ALTER SUBSCRIPTION
+ * follows, so set the owner of the table here.
+ */
+ reltup = SearchSysCache1(RELOID, ObjectIdGetDatum(logrelid));
+ if (!HeapTupleIsValid(reltup))
+ elog(ERROR, “cache lookup failed for relation %u”, logrelid);
+ relowner = ((Form_pg_class) GETSTRUCT(reltup))->relowner;
+ ReleaseSysCache(reltup);

Shouldn’t this be handled via pg-dump? IIUC, it is done to handle a
case when a user manually runs pg_dump --binary-upgrade
--use-set-session-authorization. We already document that
“-binary-upgrade” is for use by in-place upgrade utilities. Its use
for other purposes is not recommended or supported. So, I feel the
above handling is not required.

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ewan Young 2026-11-27 06:23:28 Re: [PATCH] btree_gist: overflow in gbt_numeric_penalty (sibling of 15b3dc140d9)
Previous Message Chao Li 2026-11-27 06:13:46 Fix empty and whitespace-only input handling in option_parse_int()