From 82a532b34d7547b43b90e2e4d4953f4be1c655b8 Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Sat, 21 Feb 2015 22:37:05 +0100 Subject: [PATCH] Force some system catalog table columns to be marked NOT NULL. In a manual pass over the catalog declaration I found a number of columns which the boostrap automatism didn't mark NOT NULL even though they actually were. Add BKI_FORCE_NOT_NULL markings to them. It's usually not critical if a system table column is falsely determined to be nullable as the code should always catch relevant cases. But it's good to have a extra layer in place. Discussion: 20150215170014.GE15326@awork2.anarazel.de --- src/include/catalog/pg_description.h | 2 +- src/include/catalog/pg_extension.h | 4 ++-- src/include/catalog/pg_largeobject.h | 2 +- src/include/catalog/pg_pltemplate.h | 4 ++-- src/include/catalog/pg_proc.h | 2 +- src/include/catalog/pg_seclabel.h | 4 ++-- src/include/catalog/pg_shdescription.h | 2 +- src/include/catalog/pg_shseclabel.h | 4 ++-- src/include/catalog/pg_trigger.h | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index 5a936e8747..692455f361 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -52,7 +52,7 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text description; /* description of object */ + text description BKI_FORCE_NOT_NULL; /* description of object */ #endif } FormData_pg_description; diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index f45d6cbe53..99ab35bb05 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -36,8 +36,8 @@ CATALOG(pg_extension,3079) bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - /* extversion should never be null, but the others can be. */ - text extversion; /* extension version name */ + /* extversion may never be null, but the others can be. */ + text extversion BKI_FORCE_NOT_NULL; /* extension version name */ Oid extconfig[1]; /* dumpable configuration tables */ text extcondition[1]; /* WHERE clauses for config tables */ #endif diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h index 6a8d0ccb6f..4a33752040 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -34,7 +34,7 @@ CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS int32 pageno; /* Page number (starting from 0) */ /* data has variable length, but we allow direct access; see inv_api.c */ - bytea data; /* Data for page (may be zero-length) */ + bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be zero-length) */ } FormData_pg_largeobject; /* ---------------- diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index c5e655435a..569d724036 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -35,10 +35,10 @@ CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS bool tmpldbacreate; /* PL is installable by db owner? */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text tmplhandler; /* name of call handler function */ + text tmplhandler BKI_FORCE_NOT_NULL; /* name of call handler function */ text tmplinline; /* name of anonymous-block handler, or NULL */ text tmplvalidator; /* name of validator function, or NULL */ - text tmpllibrary; /* path of shared library */ + text tmpllibrary BKI_FORCE_NOT_NULL; /* path of shared library */ aclitem tmplacl[1]; /* access privileges for template */ #endif } FormData_pg_pltemplate; diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 6fae8a0133..4268b99416 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -66,7 +66,7 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO text proargnames[1]; /* parameter names (NULL if no names) */ pg_node_tree proargdefaults;/* list of expression trees for argument * defaults (NULL if none) */ - text prosrc; /* procedure source text */ + text prosrc BKI_FORCE_NOT_NULL; /* procedure source text */ text probin; /* secondary procedure info (can be NULL) */ text proconfig[1]; /* procedure-local GUC settings */ aclitem proacl[1]; /* access permissions */ diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index d54e699023..c9f5b0cfdf 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -27,8 +27,8 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text provider; /* name of label provider */ - text label; /* security label of the object */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ #endif } FormData_pg_seclabel; diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index 723f984518..c524099898 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -44,7 +44,7 @@ CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS Oid classoid; /* OID of table containing object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text description; /* description of object */ + text description BKI_FORCE_NOT_NULL; /* description of object */ #endif } FormData_pg_shdescription; diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index f0b9952804..3977b42f87 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -26,8 +26,8 @@ CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_WITHOUT_OIDS Oid classoid; /* OID of table containing the shared object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text provider; /* name of label provider */ - text label; /* security label of the object */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ #endif } FormData_pg_shseclabel; diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index 40c8c0fceb..bff8fcfdda 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -57,7 +57,7 @@ CATALOG(pg_trigger,2620) int2vector tgattr; /* column numbers, if trigger is on columns */ #ifdef CATALOG_VARLEN - bytea tgargs; /* first\000second\000tgnargs\000 */ + bytea tgargs BKI_FORCE_NOT_NULL; /* first\000second\000tgnargs\000 */ pg_node_tree tgqual; /* WHEN expression, or NULL if none */ #endif } FormData_pg_trigger; -- 2.40.0