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
2e131178
Commit
2e131178
authored
Nov 16, 2006
by
andrey@example.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into example.com:/work/bug24219/my41
parents
81c81296
de904f54
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
23 deletions
+59
-23
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+11
-0
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+18
-0
sql/sql_table.cc
sql/sql_table.cc
+30
-23
No files found.
mysql-test/r/alter_table.result
View file @
2e131178
...
@@ -543,3 +543,14 @@ ERROR 3D000: No database selected
...
@@ -543,3 +543,14 @@ ERROR 3D000: No database selected
alter table test.t1 rename test.t1;
alter table test.t1 rename test.t1;
use test;
use test;
drop table t1;
drop table t1;
DROP TABLE IF EXISTS bug24219;
DROP TABLE IF EXISTS bug24219_2;
CREATE TABLE bug24219 (a INT, INDEX(a));
SHOW INDEX FROM bug24219;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
bug24219 1 a 1 a A NULL NULL NULL YES BTREE
ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
SHOW INDEX FROM bug24219_2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
bug24219_2 1 a 1 a A NULL NULL NULL YES BTREE disabled
DROP TABLE bug24219_2;
mysql-test/t/alter_table.test
View file @
2e131178
...
@@ -392,4 +392,22 @@ alter table test.t1 rename test.t1;
...
@@ -392,4 +392,22 @@ alter table test.t1 rename test.t1;
use
test
;
use
test
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#24219 - ALTER TABLE ... RENAME TO ... , DISABLE KEYS leads to crash
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
bug24219
;
DROP
TABLE
IF
EXISTS
bug24219_2
;
--
enable_warnings
CREATE
TABLE
bug24219
(
a
INT
,
INDEX
(
a
));
SHOW
INDEX
FROM
bug24219
;
ALTER
TABLE
bug24219
RENAME
TO
bug24219_2
,
DISABLE
KEYS
;
SHOW
INDEX
FROM
bug24219_2
;
DROP
TABLE
bug24219_2
;
# End of 4.1 tests
# End of 4.1 tests
sql/sql_table.cc
View file @
2e131178
...
@@ -2949,8 +2949,35 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -2949,8 +2949,35 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd
->
proc_info
=
"setup"
;
thd
->
proc_info
=
"setup"
;
if
(
alter_info
->
is_simple
&&
!
table
->
tmp_table
)
if
(
alter_info
->
is_simple
&&
!
table
->
tmp_table
)
{
{
error
=
0
;
switch
(
alter_info
->
keys_onoff
)
{
if
(
new_name
!=
table_name
||
new_db
!=
db
)
case
LEAVE_AS_IS
:
error
=
0
;
break
;
case
ENABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
enable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
case
DISABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
disable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
}
if
(
error
==
HA_ERR_WRONG_COMMAND
)
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_ILLEGAL_HA
,
ER
(
ER_ILLEGAL_HA
),
table
->
table_name
);
error
=
0
;
}
if
(
!
error
&&
(
new_name
!=
table_name
||
new_db
!=
db
))
{
{
thd
->
proc_info
=
"rename"
;
thd
->
proc_info
=
"rename"
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
...
@@ -2971,27 +2998,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -2971,27 +2998,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
}
if
(
!
error
)
{
switch
(
alter_info
->
keys_onoff
)
{
case
LEAVE_AS_IS
:
break
;
case
ENABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
enable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
case
DISABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
disable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
}
}
if
(
error
==
HA_ERR_WRONG_COMMAND
)
if
(
error
==
HA_ERR_WRONG_COMMAND
)
{
{
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
...
@@ -2999,6 +3005,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -2999,6 +3005,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
table
->
table_name
);
table
->
table_name
);
error
=
0
;
error
=
0
;
}
}
if
(
!
error
)
if
(
!
error
)
{
{
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
...
...
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