On Fri, 24 Jan 2025 at 10:36, vignesh C <vignes...@gmail.com> wrote:
>
> On Fri, 24 Jan 2025 at 09:51, Tom Lane <t...@sss.pgh.pa.us> wrote:
> >
> > Amit Kapila <amit.kapil...@gmail.com> writes:
> > > On Fri, Jan 24, 2025 at 8:39 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
> > >> I think the problem is not so much the underscore as the
> > >> inconsistency.  You've got "pub", "gen", and "cols" run together,
> > >> but then you feel a need to separate "type"?
> >
> > > It was easy to read and to avoid getting a single word too long.
> > > However, I do understand your concern. so will change it to
> > > pubgencolstype unless you or someone prefers pubgencols?
> >
> > I think I'd vote for "pubgencols".  I don't see what the "_type"
> > suffix is supposed to convey --- there is nothing very type-y about
> > this.
>
> I believe simply renaming the catalog column to 'pubgencols' should
> suffice. We can keep the internal structure name as 'pubgencols_type'
> as it is not exposed, unless you prefer to update it to 'pubgencols'
> as well.

The attached patch has the changes for the same.

Regards,
Vignesh
From dc57991ad7486bbc2f007fe7c09dfdacec435137 Mon Sep 17 00:00:00 2001
From: Vignesh <vignes...@gmail.com>
Date: Fri, 24 Jan 2025 12:09:09 +0530
Subject: [PATCH] Rename pubgencols_type to pubgencols for consistency with
 other column names

The column added in commit e65dbc9927, pubgencols_type, was inconsistent with
the naming conventions of other columns. This change renames it to pubgencols
for consistency.
---
 doc/src/sgml/catalogs.sgml             |  2 +-
 src/backend/catalog/pg_publication.c   |  2 +-
 src/backend/commands/publicationcmds.c |  6 +++---
 src/backend/utils/cache/relcache.c     |  2 +-
 src/bin/pg_dump/pg_dump.c              | 10 +++++-----
 src/bin/psql/describe.c                |  4 ++--
 src/include/catalog/pg_publication.h   |  2 +-
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 8ad0ed10b3..088fb175cc 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -6407,7 +6407,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
 
      <row>
       <entry role="catalog_table_entry"><para role="column_definition">
-       <structfield>pubgencols_type</structfield> <type>char</type>
+       <structfield>pubgencols</structfield> <type>char</type>
       </para>
       <para>
        Controls how to handle generated column replication when there is no
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 7900a8f6a1..41ffd494c8 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -1080,7 +1080,7 @@ GetPublication(Oid pubid)
 	pub->pubactions.pubdelete = pubform->pubdelete;
 	pub->pubactions.pubtruncate = pubform->pubtruncate;
 	pub->pubviaroot = pubform->pubviaroot;
-	pub->pubgencols_type = pubform->pubgencols_type;
+	pub->pubgencols_type = pubform->pubgencols;
 
 	ReleaseSysCache(tup);
 
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index b49d9ab78b..951ffabb65 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -836,7 +836,7 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt)
 		BoolGetDatum(pubactions.pubtruncate);
 	values[Anum_pg_publication_pubviaroot - 1] =
 		BoolGetDatum(publish_via_partition_root);
-	values[Anum_pg_publication_pubgencols_type - 1] =
+	values[Anum_pg_publication_pubgencols - 1] =
 		CharGetDatum(publish_generated_columns);
 
 	tup = heap_form_tuple(RelationGetDescr(rel), values, nulls);
@@ -1048,8 +1048,8 @@ AlterPublicationOptions(ParseState *pstate, AlterPublicationStmt *stmt,
 
 	if (publish_generated_columns_given)
 	{
-		values[Anum_pg_publication_pubgencols_type - 1] = CharGetDatum(publish_generated_columns);
-		replaces[Anum_pg_publication_pubgencols_type - 1] = true;
+		values[Anum_pg_publication_pubgencols - 1] = CharGetDatum(publish_generated_columns);
+		replaces[Anum_pg_publication_pubgencols - 1] = true;
 	}
 
 	tup = heap_modify_tuple(tup, RelationGetDescr(rel), values, nulls,
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index ee39d085eb..43219a9629 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -5820,7 +5820,7 @@ RelationBuildPublicationDesc(Relation relation, PublicationDesc *pubdesc)
 		if ((pubform->pubupdate || pubform->pubdelete) &&
 			pub_contains_invalid_column(pubid, relation, ancestors,
 										pubform->pubviaroot,
-										pubform->pubgencols_type,
+										pubform->pubgencols,
 										&invalid_column_list,
 										&invalid_gen_col))
 		{
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index af857f00c7..02e1fdf8f7 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -4291,7 +4291,7 @@ getPublications(Archive *fout)
 	int			i_pubdelete;
 	int			i_pubtruncate;
 	int			i_pubviaroot;
-	int			i_pubgencols_type;
+	int			i_pubgencols;
 	int			i,
 				ntups;
 
@@ -4316,9 +4316,9 @@ getPublications(Archive *fout)
 		appendPQExpBufferStr(query, "false AS pubviaroot, ");
 
 	if (fout->remoteVersion >= 180000)
-		appendPQExpBufferStr(query, "p.pubgencols_type ");
+		appendPQExpBufferStr(query, "p.pubgencols ");
 	else
-		appendPQExpBuffer(query, "'%c' AS pubgencols_type ", PUBLISH_GENCOLS_NONE);
+		appendPQExpBuffer(query, "'%c' AS pubgencols ", PUBLISH_GENCOLS_NONE);
 
 	appendPQExpBufferStr(query, "FROM pg_publication p");
 
@@ -4339,7 +4339,7 @@ getPublications(Archive *fout)
 	i_pubdelete = PQfnumber(res, "pubdelete");
 	i_pubtruncate = PQfnumber(res, "pubtruncate");
 	i_pubviaroot = PQfnumber(res, "pubviaroot");
-	i_pubgencols_type = PQfnumber(res, "pubgencols_type");
+	i_pubgencols = PQfnumber(res, "pubgencols");
 
 	pubinfo = pg_malloc(ntups * sizeof(PublicationInfo));
 
@@ -4365,7 +4365,7 @@ getPublications(Archive *fout)
 		pubinfo[i].pubviaroot =
 			(strcmp(PQgetvalue(res, i, i_pubviaroot), "t") == 0);
 		pubinfo[i].pubgencols_type =
-			*(PQgetvalue(res, i, i_pubgencols_type));
+			*(PQgetvalue(res, i, i_pubgencols));
 
 		/* Decide whether we want to dump it */
 		selectDumpableObject(&(pubinfo[i].dobj), fout);
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 2e84b61f18..aa4363b200 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -6373,7 +6373,7 @@ listPublications(const char *pattern)
 						  gettext_noop("Truncates"));
 	if (pset.sversion >= 180000)
 		appendPQExpBuffer(&buf,
-						  ",\n (CASE pubgencols_type\n"
+						  ",\n (CASE pubgencols\n"
 						  "    WHEN '%c' THEN 'none'\n"
 						  "    WHEN '%c' THEN 'stored'\n"
 						  "   END) AS \"%s\"",
@@ -6507,7 +6507,7 @@ describePublications(const char *pattern)
 
 	if (has_pubgencols)
 		appendPQExpBuffer(&buf,
-						  ", (CASE pubgencols_type\n"
+						  ", (CASE pubgencols\n"
 						  "    WHEN '%c' THEN 'none'\n"
 						  "    WHEN '%c' THEN 'stored'\n"
 						  "   END) AS \"%s\"\n",
diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h
index 9e6cddcac4..48c7d1a861 100644
--- a/src/include/catalog/pg_publication.h
+++ b/src/include/catalog/pg_publication.h
@@ -59,7 +59,7 @@ CATALOG(pg_publication,6104,PublicationRelationId)
 	 * 'n'(none) if generated column data should not be published. 's'(stored)
 	 * if stored generated column data should be published.
 	 */
-	char		pubgencols_type;
+	char		pubgencols;
 } FormData_pg_publication;
 
 /* ----------------
-- 
2.43.0

Reply via email to