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
304bb0c6
Commit
304bb0c6
authored
Jun 09, 2005
by
acurtis@xiphis.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#11028 Crash on create table like
Report error instead of crashing
parent
f183ee49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
mysql-test/r/create.result
mysql-test/r/create.result
+6
-0
mysql-test/t/create.test
mysql-test/t/create.test
+11
-0
sql/sql_table.cc
sql/sql_table.cc
+10
-5
No files found.
mysql-test/r/create.result
View file @
304bb0c6
...
@@ -580,3 +580,9 @@ ERROR 42000: Incorrect database name 'xyz'
...
@@ -580,3 +580,9 @@ ERROR 42000: Incorrect database name 'xyz'
create table t1(t1.name int);
create table t1(t1.name int);
create table t2(test.t2.name int);
create table t2(test.t2.name int);
drop table t1,t2;
drop table t1,t2;
create database mysqltest;
use mysqltest;
drop database mysqltest;
create table test.t1 like x;
ERROR 42000: Incorrect database name 'NULL'
drop table if exists test.t1;
mysql-test/t/create.test
View file @
304bb0c6
...
@@ -492,3 +492,14 @@ create table t1(t1.name int);
...
@@ -492,3 +492,14 @@ create table t1(t1.name int);
create
table
t2
(
test
.
t2
.
name
int
);
create
table
t2
(
test
.
t2
.
name
int
);
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug#11028: Crash on create table like
#
create
database
mysqltest
;
use
mysqltest
;
drop
database
mysqltest
;
--
error
1102
create
table
test
.
t1
like
x
;
--
disable_warnings
drop
table
if
exists
test
.
t1
;
--
enable_warnings
sql/sql_table.cc
View file @
304bb0c6
...
@@ -2298,26 +2298,31 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
...
@@ -2298,26 +2298,31 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
char
src_path
[
FN_REFLEN
],
dst_path
[
FN_REFLEN
];
char
*
db
=
table
->
db
;
char
*
db
=
table
->
db
;
char
*
table_name
=
table
->
real_name
;
char
*
table_name
=
table
->
real_name
;
char
*
src_db
=
thd
->
db
;
char
*
src_db
;
char
*
src_table
=
table_ident
->
table
.
str
;
char
*
src_table
=
table_ident
->
table
.
str
;
int
err
,
res
=
-
1
;
int
err
,
res
=
-
1
;
TABLE_LIST
src_tables_list
;
TABLE_LIST
src_tables_list
;
DBUG_ENTER
(
"mysql_create_like_table"
);
DBUG_ENTER
(
"mysql_create_like_table"
);
src_db
=
table_ident
->
db
.
str
?
table_ident
->
db
.
str
:
thd
->
db
;
/*
/*
Validate the source table
Validate the source table
*/
*/
if
(
table_ident
->
table
.
length
>
NAME_LEN
||
if
(
table_ident
->
table
.
length
>
NAME_LEN
||
(
table_ident
->
table
.
length
&&
(
table_ident
->
table
.
length
&&
check_table_name
(
src_table
,
table_ident
->
table
.
length
))
||
check_table_name
(
src_table
,
table_ident
->
table
.
length
)))
table_ident
->
db
.
str
&&
check_db_name
((
src_db
=
table_ident
->
db
.
str
)))
{
{
my_error
(
ER_WRONG_TABLE_NAME
,
MYF
(
0
),
src_table
);
my_error
(
ER_WRONG_TABLE_NAME
,
MYF
(
0
),
src_table
);
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
if
(
!
src_db
||
check_db_name
(
src_db
))
{
my_error
(
ER_WRONG_DB_NAME
,
MYF
(
0
),
src_db
?
src_db
:
"NULL"
);
DBUG_RETURN
(
-
1
);
}
src_tables_list
.
db
=
table_ident
->
db
.
str
?
table_ident
->
db
.
str
:
thd
->
db
;
src_tables_list
.
db
=
src_
db
;
src_tables_list
.
real_name
=
table_ident
->
table
.
str
;
src_tables_list
.
real_name
=
src_table
;
src_tables_list
.
next
=
0
;
src_tables_list
.
next
=
0
;
if
(
lock_and_wait_for_table_name
(
thd
,
&
src_tables_list
))
if
(
lock_and_wait_for_table_name
(
thd
,
&
src_tables_list
))
...
...
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