mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Change syntax of new CHECK NO INHERIT constraints
The initially implemented syntax, "CHECK NO INHERIT (expr)" was not deemed very good, so switch to "CHECK (expr) NO INHERIT" instead. This way it looks similar to SQL-standards compliant constraint attribute. Backport to 9.2 where the new syntax and feature was introduced. Per discussion.
This commit is contained in:
@ -218,7 +218,7 @@ ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- fa
|
||||
ALTER TABLE constraint_rename_test RENAME CONSTRAINT con1 TO con1foo; -- ok
|
||||
\d constraint_rename_test
|
||||
\d constraint_rename_test2
|
||||
ALTER TABLE constraint_rename_test ADD CONSTRAINT con2 CHECK NO INHERIT (b > 0);
|
||||
ALTER TABLE constraint_rename_test ADD CONSTRAINT con2 CHECK (b > 0) NO INHERIT;
|
||||
ALTER TABLE ONLY constraint_rename_test RENAME CONSTRAINT con2 TO con2foo; -- ok
|
||||
ALTER TABLE constraint_rename_test RENAME CONSTRAINT con2foo TO con2bar; -- ok
|
||||
\d constraint_rename_test
|
||||
@ -500,14 +500,14 @@ drop table atacc1;
|
||||
create table atacc1 (test int);
|
||||
create table atacc2 (test2 int) inherits (atacc1);
|
||||
-- ok:
|
||||
alter table atacc1 add constraint foo check no inherit (test>0);
|
||||
alter table atacc1 add constraint foo check (test>0) no inherit;
|
||||
-- check constraint is not there on child
|
||||
insert into atacc2 (test) values (-3);
|
||||
-- check constraint is there on parent
|
||||
insert into atacc1 (test) values (-3);
|
||||
insert into atacc1 (test) values (3);
|
||||
-- fail, violating row:
|
||||
alter table atacc2 add constraint foo check no inherit (test>0);
|
||||
alter table atacc2 add constraint foo check (test>0) no inherit;
|
||||
drop table atacc2;
|
||||
drop table atacc1;
|
||||
|
||||
|
Reference in New Issue
Block a user