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 1uSStJ-007rKT-1W for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 03:58:13 +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 1uSStF-00GWCV-1J for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 03:58:09 +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 1uSStE-00GWCM-GP for pgsql-hackers@lists.postgresql.org; Fri, 20 Jun 2025 03:58:09 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uSStD-00301q-0s for pgsql-hackers@lists.postgresql.org; Fri, 20 Jun 2025 03:58:08 +0000 Received: by mail-qt1-x830.google.com with SMTP id d75a77b69052e-4a43afb04a7so10928391cf.0 for ; Thu, 19 Jun 2025 20:58:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750391886; x=1750996686; 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=pap7Rm991mK7rYu+OlVR9WZQvHGLlHJmE4NMpDbHZ2A=; b=Rijfz5Ll329avA8GVzUhhdshTEK5MUEZvz5bJX+MFpdRAS7Q4TBKLPdeMX9uapLBJS aFgAyGUEF5VyMPPkjBLISqv2chVZti/wMoU+QtLwTPHSVHlvJ7zllAk/s7qQ82UR66fR 417/vOyc7nLnfToskJiLtkfa7CVANBpxeoLT0NjK1F63Q8bmkAUkTysM225dvlobaZiB RXyzs0svcdTpwVWWNwGdZnOvUzl+MHrzjoY7KETM/8g1w+zTDKBVJPpTk9L5ORbgspmg duLnq99WoG9UBAdyqqhPGSqytKSCW8AzIF7epusL0BJThwea9f5Y2zP6rEXGwhjitEog B54A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750391886; x=1750996686; 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=pap7Rm991mK7rYu+OlVR9WZQvHGLlHJmE4NMpDbHZ2A=; b=Yd96Oa34vzGyqmjfEI80QcTu8OQYA8wORhunzsgohFZVjX/kqc3L+cgO6WqRs9E7Ne 7GVfaZlcf+ksTKi+dcqm/Xb+Ph1NtA7hG0dZqqbivhID20ZxZTnkfOijdkG3YXauFAON XzldiRlcGp9SBu03pkC4L1rx8k6bTuN4LpU9AG8wEIp+x46xA68/ZRL7TUpWzlIOAzzP 5944XgNf6E5CADrBLGaLH1Hju4xff6pCNFmr8Rm+5FIDqqr5BYS0k47FdRzOTNV/D4Zd f5izuA8UkjQDhcbWaLbEDjMGkskze1QTxM6wzZ81UVmlPSWUD1+O8XPEC8638G2tR28l hBrQ== X-Forwarded-Encrypted: i=1; AJvYcCW/ErCtLisDmFKXGN5ip2VGvvMM3ms38B5ys8xcvHmUp9nCFQOB98bOeH6AfBHunmGfE3j2GOSy9aSeMFbV@lists.postgresql.org X-Gm-Message-State: AOJu0YxKS+F4xuobAutDJlW/LxNhmVZRKPYQ0iocMpI7fX0dLx17JJli fsk0gr0bbvN88mi4B4XjsZe6ijdu1DX5kLpEjsnkqrBplK7TA5FfS+AAHCxnoVSpSrKe/ICD/Ld nNpmg2uXgqXVcqEwLs2SOKaZZ3hbbqQs= X-Gm-Gg: ASbGncshi4kgfNRt7XYktFKw/mDrMhixMgLWK6C0onYl7JXM4RHkakvYuIeDyElnq4V F2NG3sxhPURsdB3Hqa/RSIOoCMfQsQvpgxmmDxPs9bPLM5UGsv5OZoWckAh+vMf6bty+tx1fXMy PxKjomk4HZnII064ytT7v+dFDnmbHLr1uTn+CpcGIYf0KM2GhFrdwBKn78DCpTxYqNGchg+orMM QI= X-Google-Smtp-Source: AGHT+IHIyRGzkUdhT4JrDXNMmIQyW/QrMAN+qI77P9+9auFBXWG62DjoiaIu+o3PiuGFUuO6UWFAVvrgonarKaTkprY= X-Received: by 2002:a05:622a:40f:b0:4a7:6f1e:6fa7 with SMTP id d75a77b69052e-4a77a208254mr22975461cf.19.1750391886114; Thu, 19 Jun 2025 20:58:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Smith Date: Fri, 20 Jun 2025 13:57:39 +1000 X-Gm-Features: AX0GCFvoYVYhVy8w_YLRDlkqNmKRBSwRe2Lfn5-YypJL1tvpSlGswFfHLtXHhH8 Message-ID: Subject: Re: Skipping schema changes in publication To: Shlok Kyal Cc: Amit Kapila , "Zhijie Hou (Fujitsu)" , vignesh C , YeXiu <1518981153@qq.com>, Ian Lawrence Barwick , Bharath Rupireddy , PostgreSQL Hackers 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 Thu, Jun 19, 2025 at 4:42=E2=80=AFPM Shlok Kyal wrote: ... > > 3. > > TBH, I was wondering why a new catalog attribute was necessary... > > > > Can't you simply re-use the existing attribute "prattrs" attribute. > > e.g. let's just define negative means exclude. > > > > e.g. a value of 1 3 means only the 1st and 3rd columns are published > > e.g. a value of -1 -3 means all columns except 1st and 3rd columns are = published > > e.g. a value of null mean all columns are published > > > > (mixes of negative and positive will not be possible) > > > > Currently I have added a new attribute 'prexcludeattrs' in > pg_publication_rel table. I used this approach because it will be > easier for user to get the exclude column list, in code no extra > processing is required to get the exclude column list. > > For an approach to use negative numbers for exclude columns. I see an > advantage that we do not need to introduce a new column for > pg_publication_rel. But in code, each time we want to get a column > list or exclude column list we need an extra processing of 'prattrs' > columns. Also I don't see any existing catalog table using a negative > attribute for column list. > > Based on above observations, I feel that the current is better. > > Please correct me if I missed an advantage for the approach you suggested= . > OK. Maybe using negative numbers was a bridge too far... But IMO it is not good to have 2 separate attributes for the lists. Doing so implies they can coexist, but that is not true. I felt there are not really 2 "kinds" of columns list anyway -- there is just a "column list" which defines columns that are either included or excluded from the publication determined by EXCEPT. Having dual lists gets weird/confusing to describe them -- you end up continually having to refer to the other one to clarify behaviour. e.g. Does 'prattrs' value NULL mean publish everything? Well, no... that depends if there is a non null 'prexcludeattrs' e.g. Does 'prexcludeattrs' value NULL mean publish everything? Well, no... that depends if there is a non null 'prattrs' Furthermore, all the code is doubling up referring to "column list" and "exclude column list" -- code / docs / comments / error messages. There are quite a lot of places the patch touches that I thought were not really needed if you don't have 2 different kinds of column-lists. To summarise, I felt it would be better to just keep the existing 'prattrs' as the one-and-only column list, but add another BOOLEAN attribute to flag whether 'prattrs' columns should be included or excluded. prattrs; prattrs_exclude; Means -------------------------------------------- 1 2 3 f only cols 1,2,3 will be published 4 5 6 t only cols 4,5,6 will NOT be published null f all cols are published (flag is ignor= ed) null t all cols are published (flag is ignor= ed) > > 5. > > + > > + Alter publication mypublication to add tab= le > > + users except column > > + security_pin: > > + > > +ALTER PUBLICATION production_publication ADD TABLE users EXCEPT (secur= ity_pin); > > > > Those tags don't seem correct. e.g. "users" and "security_pin" are not > > (???). > > > > Perhaps, every other example here is wrong too and you just copied > > them? Anyway, something here looks wrong to me. > > > I saw different documents and usage of tags seems not well defined. > For example for table we are using tags in document > create_publication.sgml, update.sgml is used, in document > table.sgml, advanced.sgml is used, and in > logical-replication.sgml is used. Similarly for column > names , or are used in different > parts of the document. > > I kept the changed tag to for the column for this patch. > Do you have any suggestions? No, for this patch I think it is best that you just follow nearby code (as you are already doing). I plan to raise another thread to ask what are the guidelines for this sort of markup which is currently used inconsistently in different places. ////////// Below are a few more review comments for v13-0003 =3D=3D=3D=3D=3D=3D Commit message 1. Typo /THe/The/ ~~~ 2. The new syntax allows specifying excluded column list when creating or altering a publication. For example: CREATE PUBLICATION pubname FOR TABLE tabname EXCEPT (exclude_column_list) or ALTER PUBLICATION pubname ADD TABLE tabname EXCEPT (exclude_column_list) ~ I felt since you say these "For example:" it would be better to give real examples. e.g. say "(col1,col2,col3)" instead of "(exclude_column_list)". ~~~ 3. Typo /family of command/family of commands/ =3D=3D=3D=3D=3D=3D doc/src/sgml/logical-replication.sgml 4. I am not sure that it was a good idea to be making a new term called an "exclude column list"... because in introduces a new concept of something that sounds like it is a different kind of list, and now you have to keep referring everywhere to both to "column list" versus "exclude column list". All the doubling up add more complication I think. IMO really there is just a "column list". Whether that list is for exclusion or not just depends on the presence of EXCEPT. So I felt maybe all places mentioning "exclude column list" could be rephrased. =3D=3D=3D=3D=3D=3D src/backend/catalog/pg_publication.c 5. +/* + * Returns true if the relation has exluded column list associated with th= e + * publication, false otherwise. + * + * If a exclude column list is found, the corresponding bitmap is returned + * through the cols parameter, if provided. The bitmap is constructed within the + * given memory context (mcxt). + */ + Typo /exluded column/an excluded column/ Typo /exclude column list/excluded column list/ ~~~ 6. +/* + * pub_exclude_collist_validate + * Process and validate the 'excluded columns' list and ensure the columns + * are all valid to exclude from publication. Checks for and raises an + * ERROR for any unknown columns, system columns, duplicate columns, or + * generated columns. + * Why can't you exclude generated columns? e.g. Maybe PUBLICATION says publish_generated_columns=3Dstored and there are 100s of such columns, but the user just wants to exclude one of them. Why say they cannot do that? Hmm. Perhaps this is being already handled elsewhere, in which case this comment still seems misleading. =3D=3D=3D=3D=3D=3D src/backend/commands/publicationcmds.c 7. + * With REPLICA IDENTITY FULL, no column list and no excluded column + * list is allowed. Really, just "no column list is allowed." same as it said before. =3D=3D=3D=3D=3D=3D Kind Regards, Peter Smith. Fujitsu Australia