sql: introduce variations of DROP CONSTRAINT
This patch introduces variations of DROP CONSTRAINT with a declared constraint type. Closes #9112 @TarantoolBot document Title: upgrade of DROP CONSTRAINT Now, instead of just `ALTER TABLE table DROP CONSTRAINT constraint;` we have 8 operator variants: 1) Statement to drop PRIMARY KEY, UNIQUE, tuple FOREIGN NEY or tuple CHECK constraints: ``` ALTER TABLE tab_name DROP CONSTRAINT constr_name; ``` This statement cannot drop a constraint if `constr_name` matches more than one constraint. 2) Statement to drop field FOREIGN NEY or field CHECK constraints: ``` ALTER TABLE tab_name DROP CONSTRAINT field_name.constr_name; ``` This statement cannot drop a constraint if `constr_name` matches more than one constraint for the `field_name` field. 3) Statement to drop PRIMARY KEY constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT constr_name PRIMARY KEY; ``` 4) Statement to drop UNIQUE constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT constr_name UNIQUE; ``` 5) Statement to drop tuple FOREIGN KEY constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT constr_name FOREIGN KEY; ``` 6) Statement to drop tuple CHECK constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT constr_name CHECK; ``` 7) Statement to drop field FOREIGN KEY constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT field_name.constr_name FOREIGN KEY; ``` 8) Statement to drop field CHECK constraint: ``` ALTER TABLE tab_name DROP CONSTRAINT field_name.constr_name CHECK; ```
Showing
- changelogs/unreleased/gh-9112-upgrade-drop-constraint.md 4 additions, 0 deletionschangelogs/unreleased/gh-9112-upgrade-drop-constraint.md
- src/box/sql/build.c 197 additions, 0 deletionssrc/box/sql/build.c
- src/box/sql/parse.y 30 additions, 0 deletionssrc/box/sql/parse.y
- src/box/sql/sqlInt.h 31 additions, 0 deletionssrc/box/sql/sqlInt.h
- test/sql-luatest/constraint_test.lua 85 additions, 0 deletionstest/sql-luatest/constraint_test.lua
Loading
Please register or sign in to comment