Allow ALTER TABLE .. SET NOT NULL to skip provably unnecessary scans

Enterprise / PostgreSQL - Robert Haas [postgresql.org] - 13 March 2019 12:55 EDT

If existing CHECK or NOT NULL constraints preclude the presence of nulls, we need not look to see whether any are present.

Sergei Kornilov, reviewed by Stephen Frost, Ildar Musin, David Rowley, and by me.

Discussion: http://postgr.es/m/81911511895540@web58j.yandex.ru

bbb96c3704 Allow ALTER TABLE .. SET NOT NULL to skip provably unnecessary scans.
doc/src/sgml/ref/alter_table.sgml | 13 +++-
src/backend/commands/tablecmds.c | 111 ++++++++++++++++++++++++------
src/test/regress/expected/alter_table.out | 54 +++++++++++++++
src/test/regress/sql/alter_table.sql | 40 +++++++++++
4 files changed, 195 insertions(+), 23 deletions(-)

Upstream: git.postgresql.org


  • Share