Rename pubgencols_type to pubgencols in pg_publication.
authorAmit Kapila <[email protected]>
Tue, 28 Jan 2025 05:12:46 +0000 (10:42 +0530)
committerAmit Kapila <[email protected]>
Tue, 28 Jan 2025 05:12:46 +0000 (10:42 +0530)
The column added in commit e65dbc9927, pubgencols_type, was inconsistent
with the naming conventions of other columns in the pg_publication
catalog.

Author: Vignesh C <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
Reviewed-by: Peter Smith <[email protected]>
Discussion: https://postgr.es/m/CALDaNm1u-ufVOW-RUsXSooqzkpohxfZYy=z78fbcr_9Pq5hbCg@mail.gmail.com

doc/src/sgml/catalogs.sgml
src/backend/catalog/pg_publication.c
src/backend/commands/publicationcmds.c
src/backend/utils/cache/relcache.c
src/bin/pg_dump/pg_dump.c
src/bin/psql/describe.c
src/include/catalog/catversion.h
src/include/catalog/pg_publication.h

index 8ad0ed10b3a6c5cf6104845506828a7b3e4e5567..088fb175ccee0784c2a9a6c83708693b74df3a80 100644 (file)
@@ -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
index 7900a8f6a1338107bc8f3a4f38fcfce09d0a0ae7..41ffd494c812463a50e14712243f0a0c210f3072 100644 (file)
@@ -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);
 
index b49d9ab78bf588b5f17e5afaa19062be2e6efde5..951ffabb6561de88e44d348d26d7b24fe3f4705e 100644 (file)
@@ -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,
index ee39d085ebefb657b19ddf8ee8a1432b2c8a3dd6..43219a9629c3b83b9e627fc36693bf09e00cd491 100644 (file)
@@ -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))
        {
index af857f00c7c969deca3be0af01cd70442d476977..02e1fdf8f786c77a348f70570507a06d0771d5db 100644 (file)
@@ -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);
index 2e84b61f184a42f82442e7c56fea9d85e1a5eb9c..aa4363b200a8e28644cf53252efe12a6f2e7c052 100644 (file)
@@ -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",
index 21b3029a1515767c48d4b2930023b91cb47e920a..6edaa20368bfa95ca26d4093dced92c57e4b0d62 100644 (file)
@@ -57,6 +57,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202501281
+#define CATALOG_VERSION_NO 202501282
 
 #endif
index 9e6cddcac4c67d76a16517b058f57f6f4e8a506e..48c7d1a8615279e34c48cf53683ac0e645cdfc5f 100644 (file)
@@ -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;
 
 /* ----------------