Skip to content

Commit 532de70

Browse files
committed
more tests, moving code around
1 parent 2bb0e71 commit 532de70

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

mysql-test/r/alter_table.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,8 +1693,10 @@ INSERT INTO tm1 VALUES (1,1,1), (2,2,2);
16931693
INSERT INTO tm2 VALUES (1,1,1), (2,2,2);
16941694
ALTER TABLE ti1;
16951695
affected rows: 0
1696+
info: Records: 0 Duplicates: 0 Warnings: 0
16961697
ALTER TABLE tm1;
16971698
affected rows: 0
1699+
info: Records: 0 Duplicates: 0 Warnings: 0
16981700
ALTER TABLE ti1 ADD COLUMN d VARCHAR(200);
16991701
affected rows: 0
17001702
info: Records: 0 Duplicates: 0 Warnings: 0

mysql-test/r/alter_table_online.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCL
1212
alter online table t1 rename to t2;
1313
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
1414
alter online table t1 algorithm=INPLACE, lock=NONE;
15+
alter online table t1;
16+
alter table t1 algorithm=INPLACE;
17+
alter table t1 lock=NONE;
1518
drop table t1;
1619
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
1720
insert into t1 (a) values (1),(2),(3);

mysql-test/r/innodb_mysql_sync.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ SET DEBUG_SYNC= 'RESET';
528528
# This should not do anything
529529
ALTER TABLE t1;
530530
affected rows: 0
531+
info: Records: 0 Duplicates: 0 Warnings: 0
531532
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuild';
532533
# Check that we rebuild the table
533534
ALTER TABLE t1 engine=innodb;

mysql-test/t/alter_table_online.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ alter online table t1 rename to t2;
2727
# No OPs
2828

2929
alter online table t1 algorithm=INPLACE, lock=NONE;
30+
alter online table t1;
31+
alter table t1 algorithm=INPLACE;
32+
alter table t1 lock=NONE;
3033

3134
drop table t1;
3235

sql/sql_table.cc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8429,9 +8429,25 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
84298429
mysql_audit_alter_table(thd, table_list);
84308430

84318431
THD_STAGE_INFO(thd, stage_setup);
8432+
8433+
handle_if_exists_options(thd, table, alter_info);
8434+
8435+
/*
8436+
Look if we have to do anything at all.
8437+
ALTER can become NOOP after handling
8438+
the IF (NOT) EXISTS options.
8439+
*/
8440+
if (alter_info->flags == 0)
8441+
{
8442+
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
8443+
ER(ER_INSERT_INFO), 0L, 0L,
8444+
thd->get_stmt_da()->current_statement_warn_count());
8445+
my_ok(thd, 0L, 0L, alter_ctx.tmp_name);
8446+
DBUG_RETURN(false);
8447+
}
8448+
84328449
if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME |
84338450
Alter_info::ALTER_KEYS_ONOFF)) &&
8434-
alter_info->flags != 0 &&
84358451
alter_info->requested_algorithm !=
84368452
Alter_info::ALTER_TABLE_ALGORITHM_COPY &&
84378453
!table->s->tmp_table) // no need to touch frm
@@ -8450,23 +8466,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
84508466
DBUG_RETURN(res);
84518467
}
84528468

8453-
if (alter_info->flags != 0)
8454-
handle_if_exists_options(thd, table, alter_info);
8455-
8456-
/*
8457-
Look if we have to do anything at all.
8458-
Normally ALTER can become NOOP only after handling
8459-
the IF (NOT) EXISTS options.
8460-
*/
8461-
if (alter_info->flags == 0)
8462-
{
8463-
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
8464-
ER(ER_INSERT_INFO), 0L, 0L,
8465-
thd->get_stmt_da()->current_statement_warn_count());
8466-
my_ok(thd, 0L, 0L, alter_ctx.tmp_name);
8467-
DBUG_RETURN(false);
8468-
}
8469-
84708469
/* We have to do full alter table. */
84718470

84728471
#ifdef WITH_PARTITION_STORAGE_ENGINE

0 commit comments

Comments
 (0)