Assert that we don't insert nulls into attnotnull catalog columns.
authorTom Lane <[email protected]>
Tue, 21 Jul 2020 16:38:08 +0000 (12:38 -0400)
committerTom Lane <[email protected]>
Tue, 21 Jul 2020 16:38:08 +0000 (12:38 -0400)
commitfb71329ad6fcd81dd3fcfb1f21308ccb64f7a834
tree541b29e237f43ec7c81575e2fef00308a6b7dfcc
parentae3d40b0cdc6bff33ad3caf5e8766b85ebe24168
Assert that we don't insert nulls into attnotnull catalog columns.

The executor checks for this error, and so does the bootstrap catalog
loader, but we never checked for it in retail catalog manipulations.
The folly of that has now been exposed, so let's add assertions
checking it.  Checking in CatalogTupleInsert[WithInfo] and
CatalogTupleUpdate[WithInfo] should be enough to cover this.

Back-patch to v10; the aforesaid functions didn't exist before that,
and it didn't seem worth adapting the patch to the oldest branches.
But given the risk of JIT crashes, I think we certainly need this
as far back as v11.

Pre-v13, we have to explicitly exclude pg_subscription.subslotname
and pg_subscription_rel.srsublsn from the checks, since they are
mismarked.  (Even if we change our mind about applying BKI_FORCE_NULL
in the branch tips, it doesn't seem wise to have assertions that
would fire in existing databases.)

Discussion: https://postgr.es/m/298837.1595196283@sss.pgh.pa.us
src/backend/catalog/indexing.c