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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0757a1b3
Commit
0757a1b3
authored
Aug 24, 2017
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: allow dropping a constraint and a column together
post-fix for
04b288ae
parent
429ca9a8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+4
-6
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+2
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-1
No files found.
mysql-test/r/alter_table.result
View file @
0757a1b3
...
...
@@ -2228,12 +2228,11 @@ alter table t1 drop column a;
ERROR 42S22: Unknown column 'a' in 'CHECK'
alter table t1 drop column b, add column b bigint first;
ERROR 42S22: Unknown column 'b' in 'CHECK'
alter table t1 drop column a, drop constraint constraint_1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
CONSTRAINT `CONSTRAINT_1` CHECK (`a` > `b`)
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int, b int, check(a>0));
...
...
@@ -2265,12 +2264,11 @@ drop table t1;
create table t1 (a int, b int, c int, unique(a,b));
alter table t1 drop column a;
ERROR 42000: Key column 'a' doesn't exist in table
alter table t1 drop column a, drop index a;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
UNIQUE KEY `a` (`a`,`b`)
`c` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
mysql-test/t/alter_table.test
View file @
0757a1b3
...
...
@@ -1852,6 +1852,7 @@ create table t1 (a int, b int, check(a>b));
alter
table
t1
drop
column
a
;
--
error
ER_BAD_FIELD_ERROR
alter
table
t1
drop
column
b
,
add
column
b
bigint
first
;
alter
table
t1
drop
column
a
,
drop
constraint
constraint_1
;
show
create
table
t1
;
drop
table
t1
;
...
...
@@ -1873,5 +1874,6 @@ drop table t1;
create
table
t1
(
a
int
,
b
int
,
c
int
,
unique
(
a
,
b
));
--
error
ER_KEY_COLUMN_DOES_NOT_EXITS
alter
table
t1
drop
column
a
;
alter
table
t1
drop
column
a
,
drop
index
a
;
show
create
table
t1
;
drop
table
t1
;
sql/sql_table.cc
View file @
0757a1b3
...
...
@@ -8041,7 +8041,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
}
/* see if the constraint depends on *only* on dropped fields */
if
(
dropped_fields
)
if
(
!
drop
&&
dropped_fields
)
{
table
->
default_column_bitmaps
();
bitmap_clear_all
(
table
->
read_set
);
...
...
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