Re: Preserve conflict log table during upgrade

From: vignesh C <vignesh21(at)gmail(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com>
Subject: Re: Preserve conflict log table during upgrade
Date: 2026-11-27 13:03:08
Message-ID: CALDaNm2HnxcQEyLhO2NHLGBUJaLwiwu6QN56PnTXf6PdPh=s+w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 27 Nov 2026 at 12:21, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:

>
> Thanks. A few comments:
>
> 1)
> + <para>
> + If a subscription has been created with the
> + <link linkend="sql-createsubscription-params-with-conflict-log-destination"><literal>conflict_log_destination</literal></link>
> + option set to <literal>table</literal> or <literal>all</literal>,
> + <application>pg_dump</application> does not dump that conflict log table
> + or its contents, unless the table is named explicitly with
> + <option>-t</option> or <option>-n</option>. Restoring the subscription
> + creates a new, empty conflict log table, whose name is derived from the OID
> + of the new subscription.
> + Privileges, comments and security labels that had been set on the old
> + conflict log table are not restored, and must be set again on the new
> + table if needed. In binary-upgrade mode, which
> + <application>pg_upgrade</application> uses, the subscription OID and its
> + conflict log table are preserved instead, with its contents, privileges,
> + comments and security labels.
> + </para>
>
> A few small problems:
> a) 'that conflict log table' is not clear

Modified

> b) 'table is named explicitly with -t or -n': table can not be named i wth -n
> c) 'with its contents, privileges,comments and security labels.': In
> binary-upgrade mode, contents are not preserved as such, these are
> carried by pg_upgrade,
> so little change needed in last sentence.

These had to be removed because of other comment fixes.

> 2)
> + 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);
> +
> + if (relowner != owner)
> + ATExecChangeOwner(logrelid, owner, true, AccessExclusiveLock);
> + }
>
> ATExecChangeOwner() does these tests already internally.

This was originally added to support using
--use-set-session-authorization together with --binary-upgrade in
pg_dump. However, since pg_upgrade does not use this option and
--binary-upgrade is intended to be used only by pg_upgrade, this code
has been removed.

Rest of the comments were fixed in the v2 version posted at [1].
[1] - https://www.postgresql.org/message-id/CALDaNm3Qwew2hWTi8xdUeXhYdGE8hqa54uC1sFkctzHpGm36WA%40mail.gmail.com

Regards,
Vignesh

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-11-27 13:03:47 Re: Fix a wrong comment in UpdateDeadTupleRetentionStatus()
Previous Message Jan Nidzwetzki 2026-11-27 13:00:31 pg_rewind reports "no rewind required" due to stale minRecoveryPoint