Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uW8TS-008jt7-LS for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2025 06:58:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uW8TQ-00EhlW-N9 for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Jun 2025 06:58:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uW8TQ-00Ehka-8p for pgsql-hackers@lists.postgresql.org; Mon, 30 Jun 2025 06:58:41 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uW8TO-004iVK-3B for pgsql-hackers@lists.postgresql.org; Mon, 30 Jun 2025 06:58:40 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-af6a315b491so1812745a12.1 for ; Sun, 29 Jun 2025 23:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751266717; x=1751871517; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hIloXW+jqYsD85vj9bzKy9+ggbQGAizERqD5h0CS0UU=; b=j3cJUAgxxfzpyhiKZGsinYUWk85TRPHG2JH2+GGiIQtqnQOwZ8UC8y0xK/xWp+3biz 9loFhpF9vg/WmhzXnysA2Z9cGJUyPoU3laJ4oKPODa1qtrZneXOTRHnNsD1r2MJIhYq5 3KXnU/03LX/adL+kMYxwJ/oGvTb08O2DHPr0qut1keCS+WHGcbAi/H+EDm3vytlixTqt KhT/Hr0BxVjWnb9U7kBxKIO6GJXyRWzax8Z0eB+swn4DUgV6piEXmqwqu71qKXkM7muY 7xPk/WEGu4QtujSIpI6zPcMMsIi4U+azdvYSlIk/mSh5ZFB3O1l0VXXVzOzQupHVGDzt hDIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751266717; x=1751871517; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hIloXW+jqYsD85vj9bzKy9+ggbQGAizERqD5h0CS0UU=; b=X3hKXqtbkUa4xuPblV54tKAvy88X58txHb4nPBn9+TUAoT+Wo2LuBnSZigDEJUV/yK vklOd1hAF6BwGdwjwhW+aEe7XOTCg7YY6gsKsuev7Ts1CUWm8n7M3OWJqifTftt6w3uM ZqZzSjUpu9NEkwR32l6Bplm9d+d9ps0cKAamWFLffSaJt3cmEnUi7vJMbQoDVOQrli40 +FMlA8eD/8tDd9ISeKxvsQedB1CVcOAFvreY0Uo6n/GTs1Fgj9VUtkLi+SDSI8BElb/G Bhepb2MVB8+8NlyRmKPVbD8llCVxaK18JAxhmKEbJzVFzKMYfqiOYHUlsvCbD/q1ArSH dqCA== X-Forwarded-Encrypted: i=1; AJvYcCVl7KZnLwR2p0MxNCpsPoxmlWZ2KibF+xk9lRHohv3w4ST8P/BYH3flufISkERmUnlcWSarzQMW7mnHxYkE@lists.postgresql.org X-Gm-Message-State: AOJu0YzgCXgdlsAj8YowsMd9pWks1b8GtkvYGoEgv9zE0wyf9VBJxmd8 EHhCAiPjffp4dIgp9t+Dtg/GHBAPtHpzpwyEFUgplm8N1apXBvV4eX4+FqoL0V7kBdMSZWNOasb LBrIQVDT4z8Lf+ciIzyCf49FJRZTgnOM= X-Gm-Gg: ASbGncuvlntGDlzUBup9/pE3n0FrQFYl2z9h57dmQ3McAJAc1+yGydAxFfrfM934DFt oK/i0rHcHVyEMKTpDMoheiyHGJDp6FG5wOpWdvqgb4BsuR6SHqx/LneUmx2ZbuSMd6G4UXxMcYD TDtGYtv4S/t3YvOH8lFidlYKIF3bsHaxx0/ufvGPuKLbp8xw== X-Google-Smtp-Source: AGHT+IHnWPObKyiRH5C7rUtfhIdjI1UQtlxpkggzrpmCKgjwxRXSn3oHWvBJ0jEDklWI+34IYE1b5Mzo3rrZLgsVaPw= X-Received: by 2002:a05:6a20:158d:b0:220:1c03:c4af with SMTP id adf61e73a8af0-220a113c19amr22447740637.8.1751266717260; Sun, 29 Jun 2025 23:58:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Mon, 30 Jun 2025 12:28:25 +0530 X-Gm-Features: Ac12FXwJ6S_LZDkYH54ZkLu3GpXPIjc-ge-9vSI3TGzhfSYqcdDomv6-xCvV1Cw Message-ID: Subject: Re: Skipping schema changes in publication To: Shlok Kyal Cc: Peter Smith , Amit Kapila , "Zhijie Hou (Fujitsu)" , vignesh C , YeXiu <1518981153@qq.com>, Ian Lawrence Barwick , Bharath Rupireddy , PostgreSQL Hackers , shveta malik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 27, 2025 at 3:44=E2=80=AFPM Shlok Kyal wrote: > > On Thu, 26 Jun 2025 at 15:27, shveta malik wrote= : > > > > On Tue, Jun 24, 2025 at 9:48=E2=80=AFAM Shlok Kyal wrote: > > > > > > I have included the changes for > > > it in v14-0003 patch. > > > > > Thanks for the patches. I have reviewed patch001 alone, please find > > few comments: > > > > 1) > > + > > + The RESET clause will reset the publication to t= he > > + default state which includes resetting the publication parameters, = setting > > + ALL TABLES flag to false and > > + dropping all relations and schemas that are associated with the > > + publication. > > > > > > It is misleading, as far as I have understood, we do not drop the > > tables or schemas associated with the pub; we just remove those from > > the publication's object list. See previous doc: > > "The ADD and DROP clauses will add and remove one or more > > tables/schemas from the publication" > > > > Perhaps we want to say the same thing when we speak about the 'drop' > > aspect of RESET. > I have updated the document. > > > 2) > > AlterPublicationReset(): > > > > + if (!OidIsValid(prid)) > > + ereport(ERROR, > > + (errcode(ERRCODE_UNDEFINED_OBJECT), > > + errmsg("relation \"%s\" is not part of the publication", > > + get_rel_name(relid)))); > > > > Can you please help me understand which scenario will give this error? > > > > Another question is do we really need this error? IIUC, we generally > > give errors if a user has explicitly called out a name of an object > > and that object is not found. Example: > > > > postgres=3D# alter publication pubnew drop table t1,tab2; > > ERROR: relation "t1" is not part of the publication > > > > While in a few other cases, we pass missing_okay as true and do not > > give errors. Please see other callers of performDeletion in > > publicationcmds.c itself. There we have usage of missing_okay=3Dtrue. I > > have not researched myself, but please analyze the cases where > > missing_okay is passed as true to figure out if those match our RESET > > case. Try to reproduce if possible and then take a call. > I thought about the above point and I also think this check is not > required. Also, the function was calling PublicationDropSchemas with > missing_ok as false. I have changed it to be true. > Okay. Is there a reason for not using PublicationDropTables() here? We have rewritten similar code in the Reset flow. > > 3) > > +ALTER PUBLICATION testpub_reset ADD ALL TABLES IN SCHEMA public; > > +ERROR: syntax error at or near "ALL" > > +LINE 1: ALTER PUBLICATION testpub_reset ADD ALL TABLES IN SCHEMA pub..= . > > > > There is a problem in syntax, I think the intention of testcase was to > > run this query successfully. > > I have fixed it. > > Thanks Shveta for reviewing the patch. I have addressed the comments > and posted an updated version v15 in [1]. Thanks for the patches. My review is in progress but please find few comments on 002: 1) where exception_object is: [ ONLY ] table_name [ * ] We have the above in CREATE and ALTER pub docs, but we do not explain ONLY with EXCEPT. We do have an explanation of ONLY under 'FOR TABLE'. But since 'FOR TABLE' and 'EXCEPT' do not go together, it is somewhat difficult to connect the dots and find the information ONLY in the context of EXCEPT. We shall have ONLY explained for EXCEPT as well. Or we can have ONLY defined in a way that both 'FOR TABLE' and 'EXCEPT' can refer to it. 2) We get tab-completion options in this command: postgres=3D# create publication pub5 for TABLE tab1 W WHERE ( WITH ( Similarly in this command: create publication pub5 for TABLES IN SCHEMA s1 But once we have 'EXCEPT TABLE', we do not get further tab-completion option like WITH(...) create publication pub5 for ALL TABLES EXCEPT TABLE tab1 3) During tab-expansion, 'EXCEPT TABLE' and 'WITH (' in the below command looks like they are connecting words. Can the gap be increased similar to tab-expansion of next command shown below: postgres=3D# create publication pub4 for ALL TABLES EXCEPT TABLE WITH ( postgres=3D# create publication pub4 for ALL TABLES TABLE TABLES IN SCHEMA 4) alter_publication.sgml.orig is a left-over in patch002. thanks Shveta