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
28b4aba4
Commit
28b4aba4
authored
Jun 13, 2012
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
b14d3ada
10f42e2c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
1 deletion
+43
-1
mysql-test/r/union.result
mysql-test/r/union.result
+17
-0
mysql-test/t/union.test
mysql-test/t/union.test
+20
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-1
sql/table.h
sql/table.h
+2
-0
No files found.
mysql-test/r/union.result
View file @
28b4aba4
...
@@ -1845,3 +1845,20 @@ dev
...
@@ -1845,3 +1845,20 @@ dev
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
dev
dev
1
1
#
# LP bug#1010729: Unexpected syntax error from UNION
# (bug #54382) with single-table join nest
#
CREATE TABLE t1 (a int);
CREATE TABLE t2 (b int);
CREATE TABLE t3 (c int);
SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
a
DROP TABLE t1, t2, t3;
CREATE TABLE t1 (pk int NOT NULL);
CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
UNION
SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
pk
DROP TABLE t1,t2;
mysql-test/t/union.test
View file @
28b4aba4
...
@@ -1237,3 +1237,23 @@ SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIM
...
@@ -1237,3 +1237,23 @@ SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIM
SELECT
(
SELECT
1
AS
a
ORDER
BY
a
)
AS
dev
;
SELECT
(
SELECT
1
AS
a
ORDER
BY
a
)
AS
dev
;
SELECT
(
SELECT
1
AS
a
LIMIT
1
)
AS
dev
;
SELECT
(
SELECT
1
AS
a
LIMIT
1
)
AS
dev
;
SELECT
(
SELECT
1
AS
a
FROM
dual
ORDER
BY
a
DESC
LIMIT
1
)
AS
dev
;
SELECT
(
SELECT
1
AS
a
FROM
dual
ORDER
BY
a
DESC
LIMIT
1
)
AS
dev
;
--
echo
#
--
echo
# LP bug#1010729: Unexpected syntax error from UNION
--
echo
# (bug #54382) with single-table join nest
--
echo
#
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t2
(
b
int
);
CREATE
TABLE
t3
(
c
int
);
SELECT
a
FROM
t1
UNION
SELECT
b
FROM
t2
JOIN
(
t3
)
ON
(
t2
.
b
=
t3
.
c
);
DROP
TABLE
t1
,
t2
,
t3
;
CREATE
TABLE
t1
(
pk
int
NOT
NULL
);
CREATE
TABLE
t2
(
pk
int
NOT
NULL
,
fk
int
NOT
NULL
);
SELECT
t1
.
pk
FROM
t1
LEFT
JOIN
(
t2
)
ON
(
t1
.
pk
=
t2
.
fk
)
UNION
SELECT
t1
.
pk
FROM
t1
LEFT
JOIN
(
t2
)
ON
(
t1
.
pk
=
t2
.
fk
);
DROP
TABLE
t1
,
t2
;
sql/sql_parse.cc
View file @
28b4aba4
...
@@ -6192,6 +6192,7 @@ TABLE_LIST *st_select_lex::end_nested_join(THD *thd)
...
@@ -6192,6 +6192,7 @@ TABLE_LIST *st_select_lex::end_nested_join(THD *thd)
embedded
->
embedding
=
embedding
;
embedded
->
embedding
=
embedding
;
join_list
->
push_front
(
embedded
);
join_list
->
push_front
(
embedded
);
ptr
=
embedded
;
ptr
=
embedded
;
embedded
->
lifted
=
1
;
}
}
else
if
(
nested_join
->
join_list
.
elements
==
0
)
else
if
(
nested_join
->
join_list
.
elements
==
0
)
{
{
...
...
sql/sql_yacc.yy
View file @
28b4aba4
...
@@ -9823,7 +9823,9 @@ table_factor:
...
@@ -9823,7 +9823,9 @@ table_factor:
lex->nest_level--;
lex->nest_level--;
}
}
else if (($3->select_lex &&
else if (($3->select_lex &&
$3->select_lex->master_unit()->is_union()) || $5)
$3->select_lex->master_unit()->is_union() &&
($3->select_lex->master_unit()->first_select() ==
$3->select_lex || !$3->lifted)) || $5)
{
{
/* simple nested joins cannot have aliases or unions */
/* simple nested joins cannot have aliases or unions */
my_parse_error(ER(ER_SYNTAX_ERROR));
my_parse_error(ER(ER_SYNTAX_ERROR));
...
...
sql/table.h
View file @
28b4aba4
...
@@ -1800,6 +1800,8 @@ struct TABLE_LIST
...
@@ -1800,6 +1800,8 @@ struct TABLE_LIST
struct
st_nested_join
*
nested_join
;
/* if the element is a nested join */
struct
st_nested_join
*
nested_join
;
/* if the element is a nested join */
TABLE_LIST
*
embedding
;
/* nested join containing the table */
TABLE_LIST
*
embedding
;
/* nested join containing the table */
List
<
TABLE_LIST
>
*
join_list
;
/* join list the table belongs to */
List
<
TABLE_LIST
>
*
join_list
;
/* join list the table belongs to */
bool
lifted
;
/* set to true when the table is moved to
the upper level at the parsing stage */
bool
cacheable_table
;
/* stop PS caching */
bool
cacheable_table
;
/* stop PS caching */
/* used in multi-upd/views privilege check */
/* used in multi-upd/views privilege check */
bool
table_in_first_from_clause
;
bool
table_in_first_from_clause
;
...
...
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