]> granicus.if.org Git - postgresql/commitdiff
Force some system catalog table columns to be marked NOT NULL.
authorAndres Freund <andres@anarazel.de>
Sat, 21 Feb 2015 21:37:05 +0000 (22:37 +0100)
committerAndres Freund <andres@anarazel.de>
Sat, 21 Feb 2015 21:37:05 +0000 (22:37 +0100)
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
src/include/catalog/pg_extension.h
src/include/catalog/pg_largeobject.h
src/include/catalog/pg_pltemplate.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_seclabel.h
src/include/catalog/pg_shdescription.h
src/include/catalog/pg_shseclabel.h
src/include/catalog/pg_trigger.h

index 5a936e874752d29080dc622c64bb2d9f3ebffdb6..692455f36109f94926df435e26bac5f7b76f98ab 100644 (file)
@@ -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;
 
index f45d6cbe534fcbc14d802517fa4842acbaef1dc5..99ab35bb052cf3c652e4c4bded70d200a9661ac5 100644 (file)
@@ -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
index 6a8d0ccb6f42a1b1860c80f8eff693adf8bd9cc1..4a33752040dc2e4969b7cde6be1b7ead6f7ef74e 100644 (file)
@@ -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;
 
 /* ----------------
index c5e655435a453b82c10464b43505f7219063ea6b..569d724036c8446933aafc7b88ed226a5ee981f4 100644 (file)
@@ -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;
index 6fae8a0133693587c38c689f8c900c5a46bb35d9..4268b99416e0f3ba14ea6da3c9eea40e8b541dcf 100644 (file)
@@ -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 */
index d54e699023917e656ff7dc391b1e87f016347260..c9f5b0cfdfc754032e51d378bb4417a6ee6197d7 100644 (file)
@@ -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;
 
index 723f984518ba38f42c3112ac7f16779e0a934623..c5240998986eed84a53c79565226964895b2269e 100644 (file)
@@ -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;
 
index f0b9952804a21121fab9ee90d4cef1ea06c5ff87..3977b42f874c6afc61ed6f03eaf3bf4da6e16057 100644 (file)
@@ -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;
 
index 40c8c0fceb27bbcc4a37e7f5286c38ee61e59346..bff8fcfddaf1d813630149cc2b4055f8244b53b5 100644 (file)
@@ -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;