Skip to content
Snippets Groups Projects
Commit 263777dc authored by Mergen Imeev's avatar Mergen Imeev Committed by Igor Munkin
Browse files

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;
```
parent 25bd19fa
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment