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
772aa695
Commit
772aa695
authored
Dec 10, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
16d15270
3c434c93
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+9
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
No files found.
mysql-test/r/order_by.result
View file @
772aa695
...
@@ -1463,6 +1463,15 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -1463,6 +1463,15 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
col
col
1
1
# Must use ref-or-null on the a_c index
EXPLAIN
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
id select_type table type possible_keys key key_len ref rows Extra
x x x ref_or_null a_c,a x x x x x
# Must return 1 row
SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC;
col
1
DROP TABLE t1;
DROP TABLE t1;
End of 5.0 tests
End of 5.0 tests
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
CREATE TABLE t2 (a varchar(32), b int(11), c float, d double,
...
...
mysql-test/t/order_by.test
View file @
772aa695
...
@@ -886,6 +886,15 @@ SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
...
@@ -886,6 +886,15 @@ SELECT 1 AS col FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c;
--
echo
# Must return 1 row
--
echo
# Must return 1 row
SELECT
1
AS
col
FROM
t1
WHERE
a
=
2
AND
(
c
=
10
OR
c
IS
NULL
)
ORDER
BY
c
;
SELECT
1
AS
col
FROM
t1
WHERE
a
=
2
AND
(
c
=
10
OR
c
IS
NULL
)
ORDER
BY
c
;
# part 2 of the problem : DESC test cases
--
echo
# Must use ref-or-null on the a_c index
--
replace_column
1
x
2
x
3
x
6
x
7
x
8
x
9
x
10
x
EXPLAIN
SELECT
1
AS
col
FROM
t1
WHERE
a
=
2
AND
(
c
=
10
OR
c
IS
NULL
)
ORDER
BY
c
DESC
;
--
echo
# Must return 1 row
SELECT
1
AS
col
FROM
t1
WHERE
a
=
2
AND
(
c
=
10
OR
c
IS
NULL
)
ORDER
BY
c
DESC
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
...
sql/sql_select.cc
View file @
772aa695
...
@@ -13487,7 +13487,7 @@ check_reverse_order:
...
@@ -13487,7 +13487,7 @@ check_reverse_order:
select
->
quick
=
tmp
;
select
->
quick
=
tmp
;
}
}
}
}
else
if
(
tab
->
type
!=
JT_NEXT
&&
else
if
(
tab
->
type
!=
JT_NEXT
&&
tab
->
type
!=
JT_REF_OR_NULL
&&
tab
->
ref
.
key
>=
0
&&
tab
->
ref
.
key_parts
<=
used_key_parts
)
tab
->
ref
.
key
>=
0
&&
tab
->
ref
.
key_parts
<=
used_key_parts
)
{
{
/*
/*
...
...
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