RE: Preserve conflict log table during upgrade

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(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 05:10:00
Message-ID: OS7PR01MB18317EF3C14DFE439ADFCAE95F5412@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I think the patch largely looks good, here are minor comments for 0002.

01.
```
if (relowner != owner)
ATExecChangeOwner(logrelid, owner, true, AccessExclusiveLock);
```

The comparison is done even in ATExecChangeOwner(), and ALTER TABLE OWNER TO
command seems to relay on it. Should we follow it?
Differences are 1) AccessExclusiveLock would be acquired anyway and
2) post-alter hook would also be called.

02.
```
/*
* subscriptions_are_dumped: Are subscriptions included in the dump?
*
* This reflects the conditions used by getSubscriptions() and
* selectDumpableObject() to determine whether a subscription is
* dumpable. Subscriptions are dumped in the post-data section.
*/
static bool
subscriptions_are_dumped(Archive *fout)
```

This checks the possibility but does not ensure subscriptions are included in
the dump. How about subscriptions_are_dumpable() or similar?

03.
```
+ <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>
```

I think the document might be too detail. At least other parts do not describe
the behavior in binary-upgrade mode. I feel the new name of the CLT is also
unnecessary.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message zengxx 2026-11-27 05:25:20 Re: [PATCH 0/1] Put presorted aggregate sort keys first in Aggregate
Previous Message Ayush Tiwari 2026-11-27 04:26:18 postgres_fdw can crash on malformed remote results