Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrNsK-0006eN-9A for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2022 17:54:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nrNsI-0005dR-VI for pgsql-hackers@arkaria.postgresql.org; Wed, 18 May 2022 17:54:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nrNsI-0005dH-FY for pgsql-hackers@lists.postgresql.org; Wed, 18 May 2022 17:54:18 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nrNsF-0006tG-JO for pgsql-hackers@lists.postgresql.org; Wed, 18 May 2022 17:54:17 +0000 Received: by mail-ej1-x629.google.com with SMTP id z2so5288320ejj.3 for ; Wed, 18 May 2022 10:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oZSnLo8Wj2gTB59WrMqhITd9Wjn7OzKTWCZngRUB6z4=; b=q7hkEmZ8L5dc0ntCCjOBARYL1G3SJygm1IRAdbA2400VLguz8Llk1cso6loseUt66L 07OtUd/xt5mMwvr+v8e00x0meXSevHzrqkueq5OZnL9jkNvTJ0Adn8GdyugMDpFiWMGA tOhSZSJ0YLMJduRtkGwhlshnQaHbLmR3M0TdrpA7HWgVekjKiTiD3OO916wCmI6HDIGe wndn055RLuAqbLQ4qq+yhhPhuDAhzL+Tp1PM6ig06QNCDHz7JA54rq7c9OR7G6Gl0pXw GuHx1n0z8773OPpzUF9XQd1kADG82eUKuFseMGqXvr0SDnZZxZjAZ887+pxQXSQeZJX8 L0xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oZSnLo8Wj2gTB59WrMqhITd9Wjn7OzKTWCZngRUB6z4=; b=c7Bt68CAxV0mKajDzXTe14+/MBSre/LYD7bhWU3od+XP8O47a+T2a69mbfXBu5BaGC J59J3MGrOslyWdLxmkMEzDsnVvMDCU7THR94m2GCBmVvFv8FY11mjOWnLkwqqEN61xzZ 6RKmKw4lWEjByn7PIbS776Q2fefntBVqnmiHR3j+p51yAZf0h6LnvC2W3K39aaqpYGTi 6tvjTctI9fT/HM0buZDN/ktXz7cKQPp/ALqZOUn8mYs96TN92u2CWmuizUM8m72Cox/0 YsVfidqxq9zIs61aTOSU6U4GxKzxIDLlvKKM8ZmIUjc7q5Qx1Q9PEBv9M1WzOucWaad/ Yd0g== X-Gm-Message-State: AOAM532xpPTZfbZpCembMd4DAdAvpEAA4p7M+Y56Vxk8/CVqWFgJpOQR OyuMk817+9dUx9/D1x9fAhilFQ9uDR7BUvsaALMFM/+d1mg= X-Google-Smtp-Source: ABdhPJzNSmv73F0JpF5bkBA5lnNrUtHB28YFuwbzWbNWZjDnLp/5SKbxNKR19hVQi3MIEsNKm/HckjJRcsmbpf+c7c8= X-Received: by 2002:a17:906:4786:b0:6f9:635f:72a7 with SMTP id cw6-20020a170906478600b006f9635f72a7mr716251ejc.326.1652896453485; Wed, 18 May 2022 10:54:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Wed, 18 May 2022 23:24:02 +0530 Message-ID: Subject: Re: Skipping schema changes in publication To: "osumi.takamichi@fujitsu.com" Cc: Peter Smith , Amit Kapila , Bharath Rupireddy , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, May 16, 2022 at 2:00 PM osumi.takamichi@fujitsu.com wrote: > > On Saturday, May 14, 2022 10:33 PM vignesh C wrote: > > Thanks for the comments, the attached v5 patch has the changes for the same. > > Also I have made the changes for SKIP Table based on the new syntax, the > > changes for the same are available in > > v5-0002-Skip-publishing-the-tables-specified-in-EXCEPT-TA.patch. > Hi, > > > > Several comments on v5-0002. > > (1) One unnecessary space before "except_pub_obj_list" syntax definition > > + except_pub_obj_list: ExceptPublicationObjSpec > + { $$ = list_make1($1); } > + | except_pub_obj_list ',' ExceptPublicationObjSpec > + { $$ = lappend($1, $3); } > + | /*EMPTY*/ { $$ = NULL; } > + ; > + > > From above part, kindly change > FROM: > " except_pub_obj_list: ExceptPublicationObjSpec" > TO: > "except_pub_obj_list: ExceptPublicationObjSpec" > Modified > (2) doc/src/sgml/ref/create_publication.sgml > > (2-1) > > @@ -22,7 +22,7 @@ PostgreSQL documentation > > > CREATE PUBLICATION name > - [ FOR ALL TABLES > + [ FOR ALL TABLES [EXCEPT TABLE [ ONLY ] table_name [ * ] [, ... ]] > | FOR publication_object [, ... ] ] > [ WITH ( publication_parameter [= value] [, ... ] ) ] > > > Here I think we need to add two more whitespaces around square brackets. > Please change > FROM: > "[ FOR ALL TABLES [EXCEPT TABLE [ ONLY ] table_name [ * ] [, ... ]]" > TO: > "[ FOR ALL TABLES [ EXCEPT TABLE [ ONLY ] table_name [ * ] [, ... ] ]" > > When I check other documentations, I see whitespaces before/after square brackets. > > (2-2) > This whitespace alignment applies to alter_publication.sgml as well. Modified > (3) > > > @@ -156,6 +156,24 @@ CREATE PUBLICATION name > > > > + > + > + EXCEPT TABLE > + > + > + Marks the publication as one that excludes replicating changes for the > + specified tables. > + > + > + > + EXCEPT TABLE can be specified only for > + FOR ALL TABLES publication. It is not supported for > + FOR ALL TABLES IN SCHEMA publication and > + FOR TABLE publication. > + > + > + > + > > This EXCEPT TABLE clause is only for FOR ALL TABLES. > So, how about extracting the main message from above part and > moving it to an exising paragraph below, instead of having one independent paragraph ? > > > FOR ALL TABLES > > > Marks the publication as one that replicates changes for all tables in > the database, including tables created in the future. > > > > > Something like > "Marks the publication as one that replicates changes for all tables in > the database, including tables created in the future. EXCEPT TABLE indicates > excluded tables for the defined publication. > " > Modified > (4) One minor confirmation about the syntax > > Currently, we allow one way of writing to indicate excluded tables like below. > > (example) CREATE PUBLICATION mypub FOR ALL TABLES EXCEPT TABLE tab3, tab4, EXCEPT TABLE tab5; > > This is because we define ExceptPublicationObjSpec with EXCEPT TABLE. > Is it OK to have a room to write duplicate "EXCEPT TABLE" clauses ? > I think there is no harm in having this, > but I'd like to confirm whether this syntax might be better to be adjusted or not. Changed it to allow except table only once > > (5) CheckAlterPublication > > + > + if (excepttable && !stmt->for_all_tables) > + ereport(ERROR, > + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > + errmsg("publication \"%s\" is not defined as FOR ALL TABLES", > + NameStr(pubform->pubname)), > + errdetail("except table cannot be added to, dropped from, or set on NON ALL TABLES publications."))); > > Could you please add a test for this ? This code can be removed because of grammar optimization, it will not allow tables without "ALL TABLES". Removed this code The v6 patch attached at [1] has the changes for the same. [1] - https://www.postgresql.org/message-id/CALDaNm0iZZDB300Dez_97S8G6_RW5QpQ8ef6X3wq8tyK-8wnXQ%40mail.gmail.com Regards, Vignesh