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
1f2f240d
Commit
1f2f240d
authored
Jan 05, 2011
by
Michael Widenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALTER TABLE IGNORE didn't ignore duplicates for unique add index for InnoDB
parent
c6cdbe2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+7
-0
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/innodb/t/innodb_mysql.test
+9
-0
sql/sql_table.cc
sql/sql_table.cc
+10
-0
No files found.
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
1f2f240d
...
...
@@ -2617,6 +2617,13 @@ rows 3
Extra Using index
DROP TABLE t1;
#
# ALTER TABLE IGNORE didn't ignore duplicates for unique add index
#
create table t1 (a int primary key, b int) engine = innodb;
insert into t1 values (1,1),(2,1);
alter ignore table t1 add unique `main` (b);
drop table t1;
#
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
...
...
mysql-test/suite/innodb/t/innodb_mysql.test
View file @
1f2f240d
...
...
@@ -840,6 +840,15 @@ CREATE INDEX b ON t1(a,b,c,d);
DROP
TABLE
t1
;
--
echo
#
--
echo
# ALTER TABLE IGNORE didn't ignore duplicates for unique add index
--
echo
#
create
table
t1
(
a
int
primary
key
,
b
int
)
engine
=
innodb
;
insert
into
t1
values
(
1
,
1
),(
2
,
1
);
alter
ignore
table
t1
add
unique
`main`
(
b
);
drop
table
t1
;
--
echo
#
...
...
sql/sql_table.cc
View file @
1f2f240d
...
...
@@ -7136,6 +7136,16 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* Non-primary unique key. */
needed_online_flags
|=
HA_ONLINE_ADD_UNIQUE_INDEX
;
needed_fast_flags
|=
HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES
;
if
(
ignore
)
{
/*
If ignore is used, we have to remove all duplicate rows,
which require a full table copy.
*/
need_copy_table
=
ALTER_TABLE_DATA_CHANGED
;
pk_changed
=
2
;
// Don't change need_copy_table
break
;
}
}
}
else
...
...
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