pgsql: Assert that we don't insert nulls into attnotnull catalog column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Assert that we don't insert nulls into attnotnull catalog column
Дата
Msg-id E1jxvHm-0002KD-C9@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3e66019f15549d3e1e13da665b2549684061d630

Modified Files
--------------
doc/src/sgml/bki.sgml          |  5 +----
src/backend/catalog/indexing.c | 45 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 4 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid direct C access to possibly-null pg_subscription_rel.srsub
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Be more careful about marking catalog columns NOT NULL by defaul