RE: Added schema level support for publication. - Mailing list pgsql-hackers

From houzj.fnst@fujitsu.com
Subject RE: Added schema level support for publication.
Date
Msg-id OS3PR01MB5718DDEACB51A10D4A338C0C94A99@OS3PR01MB5718.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: Added schema level support for publication.  (vignesh C <vignesh21@gmail.com>)
Responses Re: Added schema level support for publication.
Re: Added schema level support for publication.
List pgsql-hackers
On Tues, Sep 28, 2021 10:46 PM vignesh C <vignesh21@gmail.com> wrote:
> Attached v34 patch has the changes for the same.

Thanks for updating the patch.
Here are a few comments.

1)
+ *        ALL TABLES IN SCHEMA schema [[, ...]

[[ -> [

2)
+    /* ALTER PUBLICATION ... ADD/DROP TABLE/ALL TABLES IN SCHEMA parameters */

The two '/' seems a bit unclear and it doesn't mention the SET case.
Maybe we can write like:

/* parameters used for ALTER PUBLICATION ... ADD/DROP/SET publication objects */

3)
+    /*
+     * Check if setting the relation to a different schema will result in the
+     * publication having schema and same schema's table in the publication.
+     */
+    if (stmt->objectType == OBJECT_TABLE)
+    {
+        ListCell   *lc;
+        List       *schemaPubids = GetSchemaPublications(nspOid);
+        foreach(lc, schemaPubids)
+        {
+            Oid        pubid = lfirst_oid(lc);
+            if (list_member_oid(GetPublicationRelations(pubid, PUBLICATION_PART_ALL),
+                                relid))
+                ereport(ERROR,

How about we check this case like the following ?

List       *schemaPubids = GetSchemaPublications(nspOid);
List       *relPubids = GetRelationPublications(RelationGetRelid(rel));
if (list_intersection(schemaPubids, relPubids))
    ereport(ERROR, ...

Best regards,
Hou zj

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Make relfile tombstone files conditional on WAL level
Next
From: Bharath Rupireddy
Date:
Subject: Re: how to distinguish between using the server as a standby or for executing a targeted recovery in PG 11?