| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | vignesh C <vignesh21(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, 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-12-01 04:25:10 |
| Message-ID: | CAJpy0uATG_Uo9fo_jHnkb7D2Lv_11Xv6EE2tkw-6UN2X1sauPw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Nov 30, 2026 at 4:07 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Mon, 30 Nov 2026 at 15:23, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Fri, Nov 27, 2026 at 6:26 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > >
> > > The attached v2 version patch has the changes for the same.
> > >
> >
> > Pushed 0001, kindly rebase and send the remaining patch.
>
> Here is a rebased version, the v3 version patch also addresses Ajin's
> comments from [1] and Kuroda-san's comments from [2].
> [1] - https://www.postgresql.org/message-id/CAFPTHDZkvegyxt_P%3DtYqjKmUNHhRcGcgvQ-rE7oFr%3Dx2qCPtxQ%40mail.gmail.com
> [2] - https://www.postgresql.org/message-id/OS7PR01MB18317D4778448CA0BE8AE2B2CF54E2%40OS7PR01MB18317.jpnprd01.prod.outlook.com
>
Thanks for the patch. Below are a few comments. I will verify the
patch a bit more in sometime.
1)
+ * We control assignment of pg_subscription.oid because we want the oid to
+ * match between the old and new cluster, because CreateSubscription() finds
+ * the restored conflict log table by its name, which contains the
+ * subscription oid.v1
Does not read naturally, 'because' used twice. Suggestion:
* We control assignment of pg_subscription.oid so that it matches between
* the old and new cluster, as CreateSubscription() finds the restored
* conflict log table by its name, which contains the subscription oid.
2)
+# A comment on the table must survive the upgrade too.
+my $sub_clt_col = $old_sub->safe_psql('postgres',
+ "SELECT attname FROM pg_attribute WHERE attrelid = $sub_clt_relid
AND attnum = 1"
+);
I don't see the usage of sub_clt_col anywhere in test.
3)
+ CREATE ROLE regress_clt_reader;
+ GRANT DELETE ON pg_conflict.$sub_clt_name TO regress_clt_reader;
+]);
I think a better name would be regress_clt_user. 'reader' is
misleading, as the role is granted DELETE (not SELECT), and is used to
check several privileges after the upgrade (DELETE, INSERT, and USAGE
on the schema).
4)
pg_dump.sgml
+ <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 its conflict log table
+ or its contents. Restoring the subscription creates a new, empty
+ conflict log table. 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.
+ </para>
This is inconsistent with the surrounding paragraphs in terms of
spaces after a sentence-ending period. It uses one space, while the
neighbouring paragraphs use two.
5)
+ /*
+ * Do not emit "ALTER TABLE ... OWNER TO ..." for a conflict log table:
+ * changing its owner is not allowed. Its owner follows the owner of the
+ * subscription, and is set when the ALTER SUBSCRIPTION ... OWNER TO of
+ * the dump is restored.
+ */
Last sentence is not true in all cases; ALTER SUBSCRIPTION ... OWNER
TO is not dumped when --use-set-session-authorization is given. But
pg_upgrade does not use that option, and dumpTableSchema() (IIUC) is
not reached for a CLT in a regular pg_dump, but the comment does not
make this clear, so it is half-true. Suggestion (if you agree):
/*
* Do not emit "ALTER TABLE ... OWNER TO ..." for a conflict log table, as
* its owner cannot be changed. Such tables are dumped only for
* pg_upgrade, where the restored ALTER SUBSCRIPTION ... OWNER TO also
* sets the owner of the table. Note that ALTER SUBSCRIPTION ... OWNER TO
* is not dumped with --use-set-session-authorization, but pg_upgrade does
* not use that option.
*/
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-12-01 04:27:34 | Re: pg_upgrade's get_rel_infos_query() query can sometimes be slow |
| Previous Message | Dilip Kumar | 2026-12-01 04:24:41 | Re: Preserve conflict log table during upgrade |