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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
36eadc81
Commit
36eadc81
authored
Nov 17, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #1564: 'CREATE TABLE + UNION + same table name = crash'
(related to previous changeset)
parent
1c459785
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
sql/sql_parse.cc
sql/sql_parse.cc
+8
-7
No files found.
sql/sql_parse.cc
View file @
36eadc81
...
@@ -62,7 +62,8 @@ static void remove_escape(char *name);
...
@@ -62,7 +62,8 @@ static void remove_escape(char *name);
static
void
refresh_status
(
void
);
static
void
refresh_status
(
void
);
static
bool
append_file_to_dir
(
THD
*
thd
,
char
**
filename_ptr
,
static
bool
append_file_to_dir
(
THD
*
thd
,
char
**
filename_ptr
,
char
*
table_name
);
char
*
table_name
);
static
bool
create_total_list
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
**
result
);
static
bool
create_total_list
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
**
result
,
bool
skip_first
);
const
char
*
any_db
=
"*any*"
;
// Special symbol for check_access
const
char
*
any_db
=
"*any*"
;
// Special symbol for check_access
...
@@ -1352,7 +1353,9 @@ mysql_execute_command(void)
...
@@ -1352,7 +1353,9 @@ mysql_execute_command(void)
#endif
#endif
}
}
if
(
lex
->
select_lex
.
next
&&
create_total_list
(
thd
,
lex
,
&
tables
))
if
(
lex
->
select_lex
.
next
&&
create_total_list
(
thd
,
lex
,
&
tables
,
(
lex
->
sql_command
==
SQLCOM_CREATE_TABLE
)))
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
/*
/*
...
@@ -3487,7 +3490,8 @@ void set_lock_for_tables(thr_lock_type lock_type)
...
@@ -3487,7 +3490,8 @@ void set_lock_for_tables(thr_lock_type lock_type)
** to the entries in this list.
** to the entries in this list.
*/
*/
static
bool
create_total_list
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
**
result
)
static
bool
create_total_list
(
THD
*
thd
,
LEX
*
lex
,
TABLE_LIST
**
result
,
bool
skip_first
)
{
{
/* Handle the case when we are not using union */
/* Handle the case when we are not using union */
if
(
!
lex
->
select_lex
.
next
)
if
(
!
lex
->
select_lex
.
next
)
...
@@ -3497,8 +3501,6 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3497,8 +3501,6 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
}
}
/* We should skip first table if SQL command is SQLCOM_CREATE_TABLE */
/* We should skip first table if SQL command is SQLCOM_CREATE_TABLE */
bool
skip_first
=
(
lex
->
sql_command
==
SQLCOM_CREATE_TABLE
);
bool
first_added
=
0
;
SELECT_LEX
*
sl
;
SELECT_LEX
*
sl
;
TABLE_LIST
**
new_table_list
=
result
,
*
aux
;
TABLE_LIST
**
new_table_list
=
result
,
*
aux
;
...
@@ -3516,7 +3518,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3516,7 +3518,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
for
(;
aux
;
aux
=
next
)
for
(;
aux
;
aux
=
next
)
{
{
TABLE_LIST
*
cursor
=
*
result
;
TABLE_LIST
*
cursor
=
*
result
;
if
(
first_added
&&
skip_first
)
if
(
skip_first
&&
cursor
)
cursor
=
cursor
->
next
;
cursor
=
cursor
->
next
;
next
=
aux
->
next
;
next
=
aux
->
next
;
for
(
;
cursor
;
cursor
=
cursor
->
next
)
for
(
;
cursor
;
cursor
=
cursor
->
next
)
...
@@ -3536,7 +3538,6 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3536,7 +3538,6 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
*
new_table_list
=
cursor
;
*
new_table_list
=
cursor
;
new_table_list
=
&
cursor
->
next
;
new_table_list
=
&
cursor
->
next
;
*
new_table_list
=
0
;
// end result list
*
new_table_list
=
0
;
// end result list
first_added
=
1
;
}
}
else
else
aux
->
shared
=
1
;
// Mark that it's used twice
aux
->
shared
=
1
;
// Mark that it's used twice
...
...
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