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
2093624a
Commit
2093624a
authored
Feb 06, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #2628 "ALTER TABLE destroys table and reports success"
parent
62f193bf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
6 deletions
+38
-6
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
mysql-test/r/alter_table.result
mysql-test/r/alter_table.result
+8
-0
mysql-test/t/alter_table.test
mysql-test/t/alter_table.test
+17
-0
sql/sql_table.cc
sql/sql_table.cc
+12
-6
No files found.
BitKeeper/etc/logging_ok
View file @
2093624a
...
@@ -12,6 +12,7 @@ heikki@donna.mysql.fi
...
@@ -12,6 +12,7 @@ heikki@donna.mysql.fi
heikki@hundin.mysql.fi
heikki@hundin.mysql.fi
jani@hynda.mysql.fi
jani@hynda.mysql.fi
jorge@linux.jorge.mysql.com
jorge@linux.jorge.mysql.com
konstantin@mysql.com
lenz@mysql.com
lenz@mysql.com
miguel@hegel.(none)
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.br
...
...
mysql-test/r/alter_table.result
View file @
2093624a
...
@@ -32,3 +32,11 @@ i
...
@@ -32,3 +32,11 @@ i
2
2
3
3
4
4
name
current
name
mysqltest
name
current
name
mysqltest
mysql-test/t/alter_table.test
View file @
2093624a
...
@@ -82,3 +82,20 @@ alter table t1 drop i,add i int unsigned not null auto_increment, drop primary k
...
@@ -82,3 +82,20 @@ alter table t1 drop i,add i int unsigned not null auto_increment, drop primary k
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
# if it exists
#
create
table
t1
(
name
char
(
15
));
insert
into
t1
(
name
)
values
(
"current"
);
create
database
mysqltest
;
create
table
mysqltest
.
t1
(
name
char
(
15
));
insert
into
mysqltest
.
t1
(
name
)
values
(
"mysqltest"
);
select
*
from
t1
;
select
*
from
mysqltest
.
t1
;
--
error
1050
alter
table
t1
rename
mysqltest
.
t1
;
select
*
from
t1
;
select
*
from
mysqltest
.
t1
;
drop
table
t1
;
drop
database
mysqltest
;
sql/sql_table.cc
View file @
2093624a
...
@@ -1151,7 +1151,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -1151,7 +1151,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd
->
proc_info
=
"init"
;
thd
->
proc_info
=
"init"
;
table_name
=
table_list
->
real_name
;
table_name
=
table_list
->
real_name
;
db
=
table_list
->
db
;
db
=
table_list
->
db
;
if
(
!
new_db
)
if
(
!
new_db
||
!
strcmp
(
new_db
,
db
)
)
new_db
=
db
;
new_db
=
db
;
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_WRITE_ALLOW_READ
)))
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_WRITE_ALLOW_READ
)))
...
@@ -1161,14 +1161,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
...
@@ -1161,14 +1161,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if
(
new_name
)
if
(
new_name
)
{
{
strmov
(
new_name_buff
,
new_name
);
strmov
(
new_name_buff
,
new_name
);
fn_same
(
new_name_buff
,
table_name
,
3
);
if
(
lower_case_table_names
)
if
(
lower_case_table_names
)
casedn_str
(
new_name
);
casedn_str
(
new_name
);
if
((
lower_case_table_names
&&
if
(
new_db
==
db
&&
!
my_strcasecmp
(
new_name_buff
,
table_name
))
||
(
lower_case_table_names
&&
(
!
lower_case_table_names
&&
!
my_strcasecmp
(
new_name_buff
,
table_name
)
||
!
lower_case_table_names
&&
!
strcmp
(
new_name_buff
,
table_name
)))
!
strcmp
(
new_name_buff
,
table_name
)))
new_name
=
table_name
;
// No. Make later check easier
{
/*
Source and destination table names are equal: make later check
easier.
*/
new_name
=
table_name
;
}
else
else
{
{
if
(
table
->
tmp_table
)
if
(
table
->
tmp_table
)
...
...
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