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
bf2a90f1
Commit
bf2a90f1
authored
Nov 12, 2007
by
kaa@polly.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge polly.(none):/home/kaa/src/opt/bug30666/my50-bug29131
into polly.(none):/home/kaa/src/opt/mysql-5.0-opt
parents
3847b1b2
4aa04022
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
4 deletions
+78
-4
mysql-test/r/select.result
mysql-test/r/select.result
+39
-0
mysql-test/t/select.test
mysql-test/t/select.test
+36
-0
sql/sql_select.cc
sql/sql_select.cc
+3
-4
No files found.
mysql-test/r/select.result
View file @
bf2a90f1
...
...
@@ -4248,4 +4248,43 @@ str_to_date('1000-01-01','%Y-%m-%d') between NULL and '2000-00-00'
select str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL;
str_to_date('1000-01-01','%Y-%m-%d') between NULL and NULL
0
CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL,
c22 INT DEFAULT NULL,
KEY(c21, c22));
CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0,
c32 INT DEFAULT NULL,
c33 INT NOT NULL,
c34 INT UNSIGNED DEFAULT 0,
KEY (c33, c34, c32));
INSERT INTO t1 values (),(),(),(),();
INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
INSERT INTO t3 VALUES (1, 1, 1, 0),
(2, 2, 0, 0),
(3, 3, 1, 0),
(4, 4, 0, 0),
(5, 5, 1, 0);
SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND
t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND
t3.c33 = 1 AND t2.c22 in (1, 3)
ORDER BY c32;
c32
1
1
3
3
5
5
SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND
t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND
t3.c33 = 1 AND t2.c22 in (1, 3)
ORDER BY c32 DESC;
c32
5
5
3
3
1
1
DROP TABLE t1, t2, t3;
End of 5.0 tests
mysql-test/t/select.test
View file @
bf2a90f1
...
...
@@ -3578,4 +3578,40 @@ select str_to_date('1000-01-01','%Y-%m-%d') between '0000-00-00' and NULL;
select
str_to_date
(
'1000-01-01'
,
'%Y-%m-%d'
)
between
NULL
and
'2000-00-00'
;
select
str_to_date
(
'1000-01-01'
,
'%Y-%m-%d'
)
between
NULL
and
NULL
;
#
# Bug #30666: Incorrect order when using range conditions on 2 tables or more
#
CREATE
TABLE
t1
(
c11
INT
UNSIGNED
NOT
NULL
AUTO_INCREMENT
PRIMARY
KEY
);
CREATE
TABLE
t2
(
c21
INT
UNSIGNED
NOT
NULL
,
c22
INT
DEFAULT
NULL
,
KEY
(
c21
,
c22
));
CREATE
TABLE
t3
(
c31
INT
UNSIGNED
NOT
NULL
DEFAULT
0
,
c32
INT
DEFAULT
NULL
,
c33
INT
NOT
NULL
,
c34
INT
UNSIGNED
DEFAULT
0
,
KEY
(
c33
,
c34
,
c32
));
INSERT
INTO
t1
values
(),(),(),(),();
INSERT
INTO
t2
SELECT
a
.
c11
,
b
.
c11
FROM
t1
a
,
t1
b
;
INSERT
INTO
t3
VALUES
(
1
,
1
,
1
,
0
),
(
2
,
2
,
0
,
0
),
(
3
,
3
,
1
,
0
),
(
4
,
4
,
0
,
0
),
(
5
,
5
,
1
,
0
);
# Show that ORDER BY produces the correct results order
SELECT
c32
FROM
t1
,
t2
,
t3
WHERE
t1
.
c11
IN
(
1
,
3
,
5
)
AND
t3
.
c31
=
t1
.
c11
AND
t2
.
c21
=
t1
.
c11
AND
t3
.
c33
=
1
AND
t2
.
c22
in
(
1
,
3
)
ORDER
BY
c32
;
# Show that ORDER BY DESC produces the correct results order
SELECT
c32
FROM
t1
,
t2
,
t3
WHERE
t1
.
c11
IN
(
1
,
3
,
5
)
AND
t3
.
c31
=
t1
.
c11
AND
t2
.
c21
=
t1
.
c11
AND
t3
.
c33
=
1
AND
t2
.
c22
in
(
1
,
3
)
ORDER
BY
c32
DESC
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
End
of
5.0
tests
sql/sql_select.cc
View file @
bf2a90f1
...
...
@@ -6088,10 +6088,9 @@ make_join_readinfo(JOIN *join, ulonglong options)
ordered. If there is a temp table the ordering is done as a last
operation and doesn't prevent join cache usage.
*/
if
(
!
ordered_set
&&
!
join
->
need_tmp
&&
((
table
==
join
->
sort_by_table
&&
(
!
join
->
order
||
join
->
skip_sort_order
))
||
(
join
->
sort_by_table
==
(
TABLE
*
)
1
&&
i
!=
join
->
const_tables
)))
if
(
!
ordered_set
&&
!
join
->
need_tmp
&&
(
table
==
join
->
sort_by_table
||
(
join
->
sort_by_table
==
(
TABLE
*
)
1
&&
i
!=
join
->
const_tables
)))
ordered_set
=
1
;
switch
(
tab
->
type
)
{
...
...
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