Allow ALTER TABLE .. SET NOT NULL to skip provably unnecessary scans.
Robert Haas <rhaas@postgresql.org>
Allow ALTER TABLE .. SET NOT NULL to skip provably unnecessary scans. 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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/alter_table.sgml | modified | +11 −2 |
| src/backend/commands/tablecmds.c | modified | +90 −21 |
| src/test/regress/expected/alter_table.out | modified | +54 −0 |
| src/test/regress/sql/alter_table.sql | modified | +40 −0 |
Documentation touched
Discussion
- using index or check in ALTER TABLE SET NOT NULL 73 messages · 2017-11-28 → 2019-08-02