From fc032bed2fb809ee69eaf2fece349f65274c876f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 21 Jul 2020 13:03:48 -0400 Subject: Be more careful about marking catalog columns NOT NULL by default. The bug fixed in commit 72eab84a5 would not have occurred if initdb had a less surprising rule about which columns should be marked NOT NULL by default. Let's make that rule be strictly that the column must be fixed-width and its predecessors must be fixed-width and NOT NULL, removing the hacky and unsafe exceptions for oidvector and int2vector. Since we do still want all existing oidvector and int2vector columns to be marked NOT NULL, we have to put BKI_FORCE_NOT_NULL labels on them. But making this less magic and more documented seems like a good idea, even if it's a shade more verbose. I didn't bump catversion since the initial catalog contents are not actually changed by this patch. Note however that the contents of postgres.bki do change, and feeding an old copy of that to a new backend will produce wrong results. Discussion: https://postgr.es/m/204760.1595181800@sss.pgh.pa.us --- doc/src/sgml/bki.sgml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml index 4e7568f5ce9..272a10a98c5 100644 --- a/doc/src/sgml/bki.sgml +++ b/doc/src/sgml/bki.sgml @@ -119,7 +119,8 @@ require all columns that should be non-nullable to be marked so in pg_attribute. The bootstrap code will automatically mark catalog columns as NOT NULL - if they are fixed-width and are not preceded by any nullable column. + if they are fixed-width and are not preceded by any nullable or + variable-width column. Where this rule is inadequate, you can force correct marking by using BKI_FORCE_NOT_NULL and BKI_FORCE_NULL annotations as needed. -- cgit v1.2.3