Skip to content

Commit

Permalink
MDEV-11231 Server crashes in check_duplicate_key on CREATE TABLE ... …
Browse files Browse the repository at this point in the history
…SELECT

be consistent and don't include the table name into the error message,
no other CREATE TABLE error does it.

(the crash happened, because thd->lex->query_tables was NULL)
  • Loading branch information
vuvova committed Dec 4, 2016
1 parent c5ef621 commit 7f2fd34
Show file tree
Hide file tree
Showing 36 changed files with 286 additions and 280 deletions.
26 changes: 13 additions & 13 deletions mysql-test/r/alter_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -1535,17 +1535,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= INVALID;
ERROR HY000: Unknown ALGORITHM 'INVALID'
ALTER TABLE m1 ENABLE KEYS;
Expand All @@ -1570,17 +1570,17 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
SET SESSION old_alter_table= 0;
affected rows: 0
ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
Expand All @@ -1602,17 +1602,17 @@ ALTER TABLE t1 ADD INDEX i2(b), LOCK= NONE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i3(b), LOCK= SHARED;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i4(b), LOCK= EXCLUSIVE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i5(b), LOCK= INVALID;
ERROR HY000: Unknown LOCK type 'INVALID'
ALTER TABLE m1 ENABLE KEYS, LOCK= DEFAULT;
Expand All @@ -1632,24 +1632,24 @@ ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i2`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i5' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i5`. This is deprecated and will be disallowed in a future release.
ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1
Warnings:
Note 1831 Duplicate index 'i6' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `i6`. This is deprecated and will be disallowed in a future release.
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/r/check.result
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
Warnings:
Note 1831 Duplicate index 'n_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index 'n_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index 'n_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `n_2`. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `n_3`. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `n_4`. This is deprecated and will be disallowed in a future release.
check table t1 extended;
insert into t1 values (200000);
Table Op Msg_type Msg_text
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/r/constraints.result
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ create table t1 (a int null);
alter table t1 add constraint constraint_1 unique (a);
alter table t1 add constraint unique key_1(a);
Warnings:
Note 1831 Duplicate index 'key_1' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `key_1`. This is deprecated and will be disallowed in a future release.
alter table t1 add constraint constraint_2 unique key_2(a);
Warnings:
Note 1831 Duplicate index 'key_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index `key_2`. This is deprecated and will be disallowed in a future release.
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
Expand Down
Loading

0 comments on commit 7f2fd34

Please sign in to comment.