From 88b0a31926331eb5336ec92010b3b4f7e6efb53c Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Thu, 20 Apr 2017 23:35:30 +0900
Subject: [PATCH] Mark some columns in pg_subscription as NOT NULL.

In pg_subscription, subconninfo, subslotname, subsynccommit and
subpublications are expected not to be NULL. Therefore this patch
adds BKI_FORCE_NOT_NULL markings to them.

This patch is basically unnecessary unless the code has a bug which
wrongly sets either of those columns to NULL. But it's good to have
this as a safeguard.

Author: Masahiko Sawada
Reviewed-by: Kyotaro Horiguchi
Reported-by: Fujii Masao
Discussion: http://postgr.es/m/CAHGQGwFDWh_Qr-q_GEMpD+qH=vYPMdVqw=ZOSY3kX_Pna9R9SA@mail.gmail.com
---
 src/include/catalog/pg_subscription.h | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h
index fae542b6129..5550f199267 100644
--- a/src/include/catalog/pg_subscription.h
+++ b/src/include/catalog/pg_subscription.h
@@ -41,10 +41,17 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE
 								 * (the worker should be running) */
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
-	text		subconninfo;	/* Connection string to the publisher */
-	NameData	subslotname;	/* Slot name on publisher */
-	text		subsynccommit;	/* Synchronous commit setting for worker */
-	text		subpublications[1];	/* List of publications subscribed to */
+	/* Connection string to the publisher */
+	text		subconninfo BKI_FORCE_NOT_NULL;
+
+	/* Slot name on publisher */
+	NameData	subslotname BKI_FORCE_NOT_NULL;
+
+	/* Synchronous commit setting for worker */
+	text		subsynccommit BKI_FORCE_NOT_NULL;
+
+	/* List of publications subscribed to */
+	text		subpublications[1] BKI_FORCE_NOT_NULL;
 #endif
 } FormData_pg_subscription;
 
-- 
GitLab