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
e78f51fb
Commit
e78f51fb
authored
Nov 11, 2003
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #1564: CREATE TABLE + UNION + same table name = crash
parent
e51d0ced
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
mysql-test/r/union.result
mysql-test/r/union.result
+3
-0
mysql-test/t/union.test
mysql-test/t/union.test
+3
-0
sql/sql_parse.cc
sql/sql_parse.cc
+8
-2
No files found.
mysql-test/r/union.result
View file @
e78f51fb
...
@@ -419,4 +419,7 @@ a
...
@@ -419,4 +419,7 @@ a
3
3
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
(SELECT * FROM t1) UNION all (SELECT SQL_CALC_FOUND_ROWS * FROM t2) LIMIT 1;
Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
Wrong usage/placement of 'SQL_CALC_FOUND_ROWS'
create temporary table t1 select a from t1 union select a from t2;
create table t1 select a from t1 union select a from t2;
INSERT TABLE 't1' isn't allowed in FROM table list
drop table t1,t2;
drop table t1,t2;
mysql-test/t/union.test
View file @
e78f51fb
...
@@ -223,4 +223,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
...
@@ -223,4 +223,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
--
error
1234
--
error
1234
(
SELECT
*
FROM
t1
)
UNION
all
(
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t2
)
LIMIT
1
;
(
SELECT
*
FROM
t1
)
UNION
all
(
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t2
)
LIMIT
1
;
create
temporary
table
t1
select
a
from
t1
union
select
a
from
t2
;
--
error
1093
create
table
t1
select
a
from
t1
union
select
a
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
sql/sql_parse.cc
View file @
e78f51fb
...
@@ -3496,6 +3496,9 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3496,6 +3496,9 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
return
0
;
return
0
;
}
}
/* 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
;
...
@@ -3512,9 +3515,11 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3512,9 +3515,11 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
TABLE_LIST
*
next
;
TABLE_LIST
*
next
;
for
(;
aux
;
aux
=
next
)
for
(;
aux
;
aux
=
next
)
{
{
TABLE_LIST
*
cursor
;
TABLE_LIST
*
cursor
=
*
result
;
if
(
first_added
&&
skip_first
)
cursor
=
cursor
->
next
;
next
=
aux
->
next
;
next
=
aux
->
next
;
for
(
cursor
=
*
result
;
cursor
;
cursor
=
cursor
->
next
)
for
(
;
cursor
;
cursor
=
cursor
->
next
)
if
(
!
strcmp
(
cursor
->
db
,
aux
->
db
)
&&
if
(
!
strcmp
(
cursor
->
db
,
aux
->
db
)
&&
!
strcmp
(
cursor
->
real_name
,
aux
->
real_name
)
&&
!
strcmp
(
cursor
->
real_name
,
aux
->
real_name
)
&&
!
strcmp
(
cursor
->
alias
,
aux
->
alias
))
!
strcmp
(
cursor
->
alias
,
aux
->
alias
))
...
@@ -3531,6 +3536,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3531,6 +3536,7 @@ 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