Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b258f911
Commit
b258f911
authored
Jul 02, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ALTER TABLE .. DROP CONSTRAINT IF NOT EXISTS
parent
5c764a0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
1 deletion
+5
-1
mysql-test/r/check_constraint.result
mysql-test/r/check_constraint.result
+3
-0
mysql-test/t/check_constraint.test
mysql-test/t/check_constraint.test
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-1
No files found.
mysql-test/r/check_constraint.result
View file @
b258f911
...
...
@@ -84,6 +84,9 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t2 drop constraint c;
ERROR 42000: Can't DROP CONSTRAINT `c`; check that it exists
alter table t2 drop constraint if exists c;
Warnings:
Note 1091 Can't DROP CONSTRAINT `c`; check that it exists
alter table t2 drop constraint min;
show create table t2;
Table Create Table
...
...
mysql-test/t/check_constraint.test
View file @
b258f911
...
...
@@ -48,6 +48,7 @@ create table t2 like t1;
show
create
table
t2
;
--
error
ER_CANT_DROP_FIELD_OR_KEY
alter
table
t2
drop
constraint
c
;
alter
table
t2
drop
constraint
if
exists
c
;
alter
table
t2
drop
constraint
min
;
show
create
table
t2
;
...
...
sql/sql_table.cc
View file @
b258f911
...
...
@@ -5880,7 +5880,7 @@ drop_create_field:
}
else
if
(
drop
->
type
==
Alter_drop
::
CHECK_CONSTRAINT
)
{
for
(
uint
i
=
0
;
i
<
table
->
s
->
table_check_constraints
;
i
++
)
for
(
uint
i
=
table
->
s
->
field_check_constraints
;
i
<
table
->
s
->
table_check_constraints
;
i
++
)
{
if
(
my_strcasecmp
(
system_charset_info
,
drop
->
name
,
table
->
check_constraints
[
i
]
->
name
.
str
)
==
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment