Fix initdb's unsafe not-null-marking rule

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Fix initdb's unsafe not-null-marking rule
Date: 2020-07-19 18:03:20
Message-ID: 204760.1595181800@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Part of the blame for the pg_subscription.subslotname fiasco can be laid
at the feet of initdb's default rule for marking columns NOT NULL; that
rule is fairly arbitrary and does not guarantee to make safe choices.
I propose that we change it so that it *is* safe, ie it will only mark
fields NOT NULL if they'd certainly be safe to access as C struct fields.

Keeping the end results the same requires a few more manual applications
of BKI_FORCE_NOT_NULL than we had before. But I think that that's fine,
because it reduces the amount of poorly-documented magic in this area.
I note in particular that bki.sgml was entirely failing to tell the full
truth.

(Note: this would allow reverting the manual BKI_FORCE_NULL label that
I just added to pg_subscription.subslotname, but I feel no great desire
to do that.)

I propose this only for HEAD, not the back branches.

regards, tom lane

Attachment Content-Type Size
fix-default-not-null-markings.patch text/x-diff 9.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-07-19 19:10:16 Re: [HACKERS] [PATCH] Generic type subscripting
Previous Message David G. Johnston 2020-07-19 16:23:41 Re: Default setting for enable_hashagg_disk