Fix initdb's unsafe not-null-marking rule

Started by Tom Laneover 5 years ago1 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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

Attachments:

fix-default-not-null-markings.patchtext/x-diff; charset=us-ascii; name=fix-default-not-null-markings.patchDownload+46-42