Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 914d238

Browse files
committed
Correctly mark pg_subscription.subslotname as nullable.
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
1 parent f2b6551 commit 914d238

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

doc/src/sgml/catalogs.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7517,8 +7517,9 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
75177517
<structfield>subslotname</structfield> <type>name</type>
75187518
</para>
75197519
<para>
7520-
Name of the replication slot in the upstream database. Also used
7521-
for local replication origin name.
7520+
Name of the replication slot in the upstream database (also used
7521+
for the local replication origin name);
7522+
null represents <literal>NONE</literal>
75227523
</para></entry>
75237524
</row>
75247525

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 202007131
56+
#define CATALOG_VERSION_NO 202007191
5757

5858
#endif

src/include/catalog/pg_subscription.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW
5353
text subconninfo BKI_FORCE_NOT_NULL;
5454

5555
/* Slot name on publisher */
56-
NameData subslotname;
56+
NameData subslotname BKI_FORCE_NULL;
5757

5858
/* Synchronous commit setting for worker */
5959
text subsynccommit BKI_FORCE_NOT_NULL;

src/test/regress/expected/subscription.out

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ DROP SUBSCRIPTION regress_testsub;
147147
ERROR: DROP SUBSCRIPTION cannot run inside a transaction block
148148
COMMIT;
149149
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
150+
\dRs+
151+
List of subscriptions
152+
Name | Owner | Enabled | Publication | Synchronous commit | Conninfo
153+
-----------------+----------------------------+---------+---------------------+--------------------+------------------------------
154+
regress_testsub | regress_subscription_user2 | f | {testpub2,testpub3} | local | dbname=regress_doesnotexist2
155+
(1 row)
156+
150157
-- now it works
151158
BEGIN;
152159
DROP SUBSCRIPTION regress_testsub;

src/test/regress/sql/subscription.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ COMMIT;
109109

110110
ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
111111

112+
\dRs+
113+
112114
-- now it works
113115
BEGIN;
114116
DROP SUBSCRIPTION regress_testsub;

0 commit comments

Comments
 (0)