Correctly mark pg_subscription.subslotname as nullable.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 19 Jul 2020 16:37:23 +0000 (12:37 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 19 Jul 2020 16:37:23 +0000 (12:37 -0400)
Due to the layout of this catalog, subslotname has to be explicitly
marked BKI_FORCE_NULL, else initdb will default to the assumption
that it's non-nullable.  Since, in fact, CREATE/ALTER SUBSCRIPTION
will store null values there, the existing marking is just wrong,
and has been since this catalog was invented.

We haven't noticed because not much in the system actually depends
on attnotnull being truthful.  However, JIT'ed tuple deconstruction
does depend on that in some cases, allowing crashes or wrong answers
in queries that inspect pg_subscription.  Commit 9de77b545 quite
accidentally exposed this on the buildfarm members that force JIT
activation.

Back-patch to v13.  The problem goes further back, but we cannot
force initdb in released branches, so some klugier solution will
be needed there.  Before working on that, push this simple fix
to try to get the buildfarm back to green.

Discussion: https://postgr.es/m/4118109.1595096139@sss.pgh.pa.us

doc/src/sgml/catalogs.sgml
src/include/catalog/catversion.h
src/include/catalog/pg_subscription.h

index 18ab3d434cb1dd6e45511af85b5a83e127f2a6ac..80c183b2355b88374f29aaca2c4b2e23b678ffca 100644 (file)
@@ -7529,7 +7529,8 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
       </para>
       <para>
        Name of the replication slot in the upstream database (also used
-       for the local replication origin name)
+       for the local replication origin name);
+       null represents <literal>NONE</literal>
       </para></entry>
      </row>
 
index ccb586ad00f4109afad967a7911e1dd480543b6e..dab7f4f47131cfadca4897205ade7c137cb43ade 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 202007181
+#define CATALOG_VERSION_NO 202007192
 
 #endif
index a041ce9740adc1d1a02081f128eb96ad833738bd..9795c35000d89d870d711338995c3402de232d67 100644 (file)
@@ -56,7 +56,7 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW
    text        subconninfo BKI_FORCE_NOT_NULL;
 
    /* Slot name on publisher */
-   NameData    subslotname;
+   NameData    subslotname BKI_FORCE_NULL;
 
    /* Synchronous commit setting for worker */
    text        subsynccommit BKI_FORCE_NOT_NULL;