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 1oWDWB-0006m7-An for pgsql-committers@arkaria.postgresql.org; Thu, 08 Sep 2022 09:08:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oWDW9-0006jp-TX for pgsql-committers@arkaria.postgresql.org; Thu, 08 Sep 2022 09:08:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWDW9-0006jf-KO for pgsql-committers@lists.postgresql.org; Thu, 08 Sep 2022 09:08:13 +0000 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oWDW5-0002Ib-Rc for pgsql-committers@lists.postgresql.org; Thu, 08 Sep 2022 09:08:12 +0000 Received: by mail-ot1-x335.google.com with SMTP id q39-20020a056830442700b0063889adc0ddso11965388otv.1 for ; Thu, 08 Sep 2022 02:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=bP2bPu5M0dW5cPk3fjiNELrxo4Q5RViI7HTyaLmfY7Q=; b=WYL2VXDfw2Xsk+e5TNjpmd9fwJ8/3BbrmorIVknofaH95d0r1d9ctM3x92Sxb+yHf+ 73zgfPKaYRvyScUSNr7Afm4wS1PTZFTpfFo/JV7+r/YHnZL1jJk7BPUrLvzuTXbWkCG3 oitRnvs7GvULAbHlN9h2DQZp7Vfcl7VEr9In+4C1xruYFVNZ5wUsr7qcej7L6aG04pfE BDdYTI7ASKLUMTgHRdIOYIzX3lviSlODBYipuQ9VE6hnsPNbBIjNLNVtxvnB3FkjxLVo olW2aPeswyjhXCX2X340y4MybNkOPf7iHV9lRQveq7rFDd+B9D/WrYZorT6GxZsSBgFj 9wGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=bP2bPu5M0dW5cPk3fjiNELrxo4Q5RViI7HTyaLmfY7Q=; b=MTA9jHLHzH9hxoyqnFdlN+toM4BEU8lF3X+C2lbtOSKWpso5eF3NBzRwNCJjmdM7Up 44pJzJSYT9BSmcf/xalVRXwSDXKUX1vCtcLnkNi9/t/zoEeQrWPxDPJG7ts4FfI9pJvJ ODbC8TBl/7XFO1BHHhMK4kl9BUFOGLrt8Cyn/J95qDVHylUCkR7/ikst5fPIxNEuWIRp R+9CKvFEVIl/r0UG+qQstYQomOgLcD+boC1Ph1QKXrD9YNQ+cmUeJlZGMCFbWCqhh2mw zO2CjkaO0D9Fbv0dpuwjV50BsQ16dMfNI14PDthGNLbIwXQOfErO2kCKeMPqAHEAePCF ZVuQ== X-Gm-Message-State: ACgBeo35TXMRiUNPS56GoTOtO55mPfjVcBI9/SRZT3Yq8iHwcGUweAVj xtIHBVHQlMOgA+O9IJrTcIryfGaVL7ViuJ4lf221imBPneE= X-Google-Smtp-Source: AA6agR7mngBsmuHih4EDoS9sXw1e0yvHlacfHq1PpEgNcwFGI9U8yTV9fVaj8wepqIJinPkZ04j6m2qxk6edoAtpx1M= X-Received: by 2002:a9d:6a8:0:b0:654:bbc:4558 with SMTP id 37-20020a9d06a8000000b006540bbc4558mr175703otx.350.1662628088168; Thu, 08 Sep 2022 02:08:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Thu, 8 Sep 2022 18:07:32 +0900 Message-ID: Subject: Re: pgsql: Raise a warning if there is a possibility of data from multiple To: Amit Kapila Cc: Amit Kapila , pgsql-committers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 8, 2022 at 4:23 PM Amit Kapila wrote: > > On Thu, Sep 8, 2022 at 12:22 PM Masahiko Sawada wrote: > > > > On Thu, Sep 8, 2022 at 10:39 AM Amit Kapila wrote: > > > > > > Raise a warning if there is a possibility of data from multiple origins. > > > > > > This commit raises a warning message for a combination of options > > > ('copy_data = true' and 'origin = none') during CREATE/ALTER subscription > > > operations if the publication tables were also replicated from other > > > publishers. > > > > > > During replication, we can skip the data from other origins as we have that > > > information in WAL but that is not possible during initial sync so we raise > > > a warning if there is such a possibility. > > > > > > Author: Vignesh C > > > Reviewed-By: Peter Smith, Amit Kapila, Jonathan Katz, Shi yu, Wang wei > > > Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com > > > > > > Branch > > > ------ > > > master > > > > > > Details > > > ------- > > > https://git.postgresql.org/pg/commitdiff/875693019053b8897ec3983e292acbb439b088c3 > > > > > > Modified Files > > > -------------- > > > doc/src/sgml/ref/alter_subscription.sgml | 5 ++ > > > doc/src/sgml/ref/create_subscription.sgml | 35 ++++++++ > > > src/backend/commands/subscriptioncmds.c | 133 ++++++++++++++++++++++++++++-- > > > src/test/subscription/t/030_origin.pl | 114 +++++++++++++++++++------ > > > 4 files changed, 258 insertions(+), 29 deletions(-) > > > > + appendStringInfoString(&cmd, > > + "SELECT DISTINCT > > P.pubname AS pubname\n" > > + "FROM pg_publication P,\n" > > + " LATERAL > > pg_get_publication_tables(P.pubname) GPT\n" > > + " JOIN > > pg_subscription_rel PS ON (GPT.relid = PS.srrelid),\n" > > + " pg_class C > > JOIN pg_namespace N ON (N.oid = C.relnamespace)\n" > > + "WHERE C.oid = > > GPT.relid AND P.pubname IN ("); > > > > Should the tables and the function in this query be schema-qualified? > > Looking at other code in subscriptioncmd.c, we use schema-qualified > > names. It works even without the schema names but it may be better to > > make them consistent. > > > > FYI, looking at tablesync.c, there are both styles; it seems that > > recently added codes use schema-unqualified names. > > > > Yeah, it is better to be consistent in all places and add a schema > name before accessing an object rather than for one or two places. Do > we need similar handling for pg_dump code as well, see > getPublications()? We can fix at least getPublications() and getSubscriptions() as well. I'll make a patch for that. Or do you want to fix all of them, including non-logical-replication-related ones? Regards, -- Masahiko Sawada