With commit f4e53e10b6ce we introduced a way to flip the NO INHERIT bit on not-null constraints. However, because of the way the grammar dealt with ALTER CONSTRAINT, we were too blind to see a way to implement it using the existing production. It turns out that we can remove it, so the commands would be
ALTER TABLE tab ALTER CONSTRAINT constr INHERIT ALTER TABLE tab ALTER CONSTRAINT constr NO INHERIT i.e. the word SET is no longer needed. Do people find this better? A proposed patch is attached. One thing not fully clear to me is that now the entry for ALTER CONSTRAINT in the sgml docs is awkward, because it describes the INHERIT flag separate from the deferrability flags. After this patch, it's a bit more obvious that the error messages we're throwing now aren't ideal: 55432 18devel 2953943=# create table foo (a int not null); CREATE TABLE 55432 18devel 2953943=# alter table foo alter constraint foo_a_not_null no inherit deferrable; ERROR: constraint "foo_a_not_null" of relation "foo" is not a foreign key constraint 55432 18devel 2953943=# create table bar (a int primary key references bar); CREATE TABLE 55432 18devel 2953943=# alter table bar alter constraint bar_a_fkey deferrable no inherit; ERROR: constraint "bar_a_fkey" of relation "bar" is not a not-null constraint -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Saca el libro que tu religión considere como el indicado para encontrar la oración que traiga paz a tu alma. Luego rebootea el computador y ve si funciona" (Carlos Duclós)