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
b135bcab
Commit
b135bcab
authored
Jan 28, 2009
by
Gleb Shchepa
Browse files
Options
Browse Files
Download
Plain Diff
automerge 5.0-bugteam --> 5.1-bugteam (bug 39069)
parents
a931ac09
334e249f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
mysql-test/r/subselect3.result
mysql-test/r/subselect3.result
+54
-0
mysql-test/t/subselect3.test
mysql-test/t/subselect3.test
+29
-0
sql/sql_select.cc
sql/sql_select.cc
+5
-0
No files found.
mysql-test/r/subselect3.result
View file @
b135bcab
...
...
@@ -795,6 +795,60 @@ WHERE INNR.varchar_key > 'n{'
);
varchar_nokey
DROP TABLE t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (11);
# 2nd and 3rd columns should be same
SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1 GROUP BY t1.a;
a ROW(11, 12) = (SELECT a, 22) ROW(11, 12) IN (SELECT a, 22)
1 0 0
2 0 0
11 0 0
SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1 GROUP BY t1.a;
a ROW(11, 12) = (SELECT a, 12) ROW(11, 12) IN (SELECT a, 12)
1 0 0
2 0 0
11 1 1
SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1;
a ROW(11, 12) = (SELECT a, 22) ROW(11, 12) IN (SELECT a, 22)
1 0 0
2 0 0
11 0 0
SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1;
a ROW(11, 12) = (SELECT a, 12) ROW(11, 12) IN (SELECT a, 12)
1 0 0
2 0 0
11 1 1
SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 22), ROW(11, 12) IN (SELECT MAX(x), 22) FROM t1;
x ROW(11, 12) = (SELECT MAX(x), 22) ROW(11, 12) IN (SELECT MAX(x), 22)
1 0 0
2 0 0
11 0 0
# 2nd and 3rd columns should be same for x == 11 only
SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1;
x ROW(11, 12) = (SELECT MAX(x), 12) ROW(11, 12) IN (SELECT MAX(x), 12)
1 0 1
2 0 1
11 1 1
DROP TABLE t1;
# both columns should be same
SELECT ROW(1,2) = (SELECT NULL, NULL), ROW(1,2) IN (SELECT NULL, NULL);
ROW(1,2) = (SELECT NULL, NULL) ROW(1,2) IN (SELECT NULL, NULL)
NULL NULL
SELECT ROW(1,2) = (SELECT 1, NULL), ROW(1,2) IN (SELECT 1, NULL);
ROW(1,2) = (SELECT 1, NULL) ROW(1,2) IN (SELECT 1, NULL)
NULL NULL
SELECT ROW(1,2) = (SELECT NULL, 2), ROW(1,2) IN (SELECT NULL, 2);
ROW(1,2) = (SELECT NULL, 2) ROW(1,2) IN (SELECT NULL, 2)
NULL NULL
SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1);
ROW(1,2) = (SELECT NULL, 1) ROW(1,2) IN (SELECT NULL, 1)
0 0
SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1);
ROW(1,2) = (SELECT 1, 1) ROW(1,2) IN (SELECT 1, 1)
0 0
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
ROW(1,2) = (SELECT 1, 2) ROW(1,2) IN (SELECT 1, 2)
1 1
End of 5.0 tests
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
...
...
mysql-test/t/subselect3.test
View file @
b135bcab
...
...
@@ -640,6 +640,35 @@ WHERE NULL NOT IN (
DROP
TABLE
t1
;
#
# Bug #39069: <row constructor> IN <table-subquery> seriously messed up
#
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
11
);
--
echo
# 2nd and 3rd columns should be same
SELECT
a
,
ROW
(
11
,
12
)
=
(
SELECT
a
,
22
),
ROW
(
11
,
12
)
IN
(
SELECT
a
,
22
)
FROM
t1
GROUP
BY
t1
.
a
;
SELECT
a
,
ROW
(
11
,
12
)
=
(
SELECT
a
,
12
),
ROW
(
11
,
12
)
IN
(
SELECT
a
,
12
)
FROM
t1
GROUP
BY
t1
.
a
;
SELECT
a
,
ROW
(
11
,
12
)
=
(
SELECT
a
,
22
),
ROW
(
11
,
12
)
IN
(
SELECT
a
,
22
)
FROM
t1
;
SELECT
a
,
ROW
(
11
,
12
)
=
(
SELECT
a
,
12
),
ROW
(
11
,
12
)
IN
(
SELECT
a
,
12
)
FROM
t1
;
# The x alias is used below to workaround bug #40674.
# Regression tests for sum function on outer column in subselect from dual:
SELECT
a
AS
x
,
ROW
(
11
,
12
)
=
(
SELECT
MAX
(
x
),
22
),
ROW
(
11
,
12
)
IN
(
SELECT
MAX
(
x
),
22
)
FROM
t1
;
--
echo
# 2nd and 3rd columns should be same for x == 11 only
SELECT
a
AS
x
,
ROW
(
11
,
12
)
=
(
SELECT
MAX
(
x
),
12
),
ROW
(
11
,
12
)
IN
(
SELECT
MAX
(
x
),
12
)
FROM
t1
;
DROP
TABLE
t1
;
--
echo
# both columns should be same
SELECT
ROW
(
1
,
2
)
=
(
SELECT
NULL
,
NULL
),
ROW
(
1
,
2
)
IN
(
SELECT
NULL
,
NULL
);
SELECT
ROW
(
1
,
2
)
=
(
SELECT
1
,
NULL
),
ROW
(
1
,
2
)
IN
(
SELECT
1
,
NULL
);
SELECT
ROW
(
1
,
2
)
=
(
SELECT
NULL
,
2
),
ROW
(
1
,
2
)
IN
(
SELECT
NULL
,
2
);
SELECT
ROW
(
1
,
2
)
=
(
SELECT
NULL
,
1
),
ROW
(
1
,
2
)
IN
(
SELECT
NULL
,
1
);
SELECT
ROW
(
1
,
2
)
=
(
SELECT
1
,
1
),
ROW
(
1
,
2
)
IN
(
SELECT
1
,
1
);
SELECT
ROW
(
1
,
2
)
=
(
SELECT
1
,
2
),
ROW
(
1
,
2
)
IN
(
SELECT
1
,
2
);
--
echo
End
of
5.0
tests
#
...
...
sql/sql_select.cc
View file @
b135bcab
...
...
@@ -1676,8 +1676,13 @@ JOIN::exec()
We have to test for 'conds' here as the WHERE may not be constant
even if we don't have any tables for prepared statements or if
conds uses something like 'rand()'.
If the HAVING clause is either impossible or always true, then
JOIN::having is set to NULL by optimize_cond.
In this case JOIN::exec must check for JOIN::having_value, in the
same way it checks for JOIN::cond_value.
*/
if
(
cond_value
!=
Item
::
COND_FALSE
&&
having_value
!=
Item
::
COND_FALSE
&&
(
!
conds
||
conds
->
val_int
())
&&
(
!
having
||
having
->
val_int
()))
{
...
...
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