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
96629f2c
Commit
96629f2c
authored
Mar 13, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B26672-5.0-opt
parents
d0a62312
d2c977a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
1 deletion
+41
-1
mysql-test/r/order_by.result
mysql-test/r/order_by.result
+22
-0
mysql-test/t/order_by.test
mysql-test/t/order_by.test
+15
-0
sql/filesort.cc
sql/filesort.cc
+4
-1
No files found.
mysql-test/r/order_by.result
View file @
96629f2c
...
...
@@ -958,3 +958,25 @@ a ratio
19 1.3333
9 2.6667
drop table t1;
CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
UPDATE t1 SET b = SEC_TO_TIME(a);
SELECT a, b FROM t1 ORDER BY b DESC;
a b
1000000 277:46:40
100000 27:46:40
10000 02:46:40
1000 00:16:40
100 00:01:40
10 00:00:10
0 00:00:00
SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
a b
1000000 277:46:40
100000 27:46:40
10000 02:46:40
1000 00:16:40
100 00:01:40
10 00:00:10
0 00:00:00
DROP TABLE t1;
mysql-test/t/order_by.test
View file @
96629f2c
...
...
@@ -677,3 +677,18 @@ create table t1 (a int, b int, c int);
insert
into
t1
values
(
1
,
2
,
3
),
(
9
,
8
,
3
),
(
19
,
4
,
3
),
(
1
,
4
,
9
);
select
a
,(
sum
(
b
)
/
sum
(
c
))
as
ratio
from
t1
group
by
a
order
by
sum
(
b
)
/
sum
(
c
)
asc
;
drop
table
t1
;
#
# Bug#26672: Incorrect SEC_TO_TIME() casting in ORDER BY
#
CREATE
TABLE
t1
(
a
INT
UNSIGNED
NOT
NULL
,
b
TIME
);
INSERT
INTO
t1
(
a
)
VALUES
(
100000
),
(
0
),
(
100
),
(
1000000
),(
10000
),
(
1000
),
(
10
);
UPDATE
t1
SET
b
=
SEC_TO_TIME
(
a
);
--
Correct
ORDER
SELECT
a
,
b
FROM
t1
ORDER
BY
b
DESC
;
--
must
be
ordered
as
the
above
SELECT
a
,
b
FROM
t1
ORDER
BY
SEC_TO_TIME
(
a
)
DESC
;
DROP
TABLE
t1
;
sql/filesort.cc
View file @
96629f2c
...
...
@@ -1298,7 +1298,10 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
}
else
{
switch
((
sortorder
->
result_type
=
sortorder
->
item
->
result_type
()))
{
sortorder
->
result_type
=
sortorder
->
item
->
result_type
();
if
(
sortorder
->
item
->
result_as_longlong
())
sortorder
->
result_type
=
INT_RESULT
;
switch
(
sortorder
->
result_type
)
{
case
STRING_RESULT
:
sortorder
->
length
=
sortorder
->
item
->
max_length
;
set_if_smaller
(
sortorder
->
length
,
thd
->
variables
.
max_sort_length
);
...
...
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