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
6e5bcca7
Commit
6e5bcca7
authored
Nov 09, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
05f21b21
6b67bafc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
3 deletions
+82
-3
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+37
-1
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/innodb/t/innodb_mysql.test
+35
-1
sql/opt_index_cond_pushdown.cc
sql/opt_index_cond_pushdown.cc
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+9
-0
No files found.
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
6e5bcca7
...
...
@@ -2609,5 +2609,41 @@ ref NULL
rows 3
Extra Using index
DROP TABLE t1;
#
End of 5.1 tests
#
# Bug#668644: HAVING + ORDER BY
#
CREATE TABLE t1 (
pk int NOT NULL PRIMARY KEY, i int DEFAULT NULL,
INDEX idx (i)
) ENGINE=INNODB;
INSERT INTO t1 VALUES
(6,-1636630528),(2,-1097924608),(1,6),(3,6),(4,1148715008),(5,1541734400);
CREATE TABLE t2 (
i int DEFAULT NULL,
pk int NOT NULL PRIMARY KEY,
INDEX idx (i)
) ENGINE= INNODB;
INSERT INTO t2 VALUES
(-1993998336,20),(-1036582912,1),(-733413376,5),(-538247168,16),
(-514260992,4),(-249561088,9),(1,2),(1,6),(2,10),(2,19),(4,17),
(5,14),(5,15),(6,8),(7,13),(8,18),(9,11),(9,12),(257425408,7),
(576061440,3);
EXPLAIN
SELECT t1 .i AS f FROM t1, t2
WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
HAVING f > 7
ORDER BY f;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
1 SIMPLE t2 ref idx idx 5 test.t1.pk 1 Using index
SELECT t1 .i AS f FROM t1, t2
WHERE t2.i = t1.pk AND t1.pk BETWEEN 0 AND 224
HAVING f > 7
ORDER BY f;
f
1148715008
1541734400
1541734400
DROP TABLE t1, t2;
End of 5.3 tests
mysql-test/suite/innodb/t/innodb_mysql.test
View file @
6e5bcca7
...
...
@@ -840,7 +840,41 @@ CREATE INDEX b ON t1(a,b,c,d);
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Bug#668644: HAVING + ORDER BY
--
echo
#
CREATE
TABLE
t1
(
pk
int
NOT
NULL
PRIMARY
KEY
,
i
int
DEFAULT
NULL
,
INDEX
idx
(
i
)
)
ENGINE
=
INNODB
;
INSERT
INTO
t1
VALUES
(
6
,
-
1636630528
),(
2
,
-
1097924608
),(
1
,
6
),(
3
,
6
),(
4
,
1148715008
),(
5
,
1541734400
);
--
echo
End
of
5.1
tests
CREATE
TABLE
t2
(
i
int
DEFAULT
NULL
,
pk
int
NOT
NULL
PRIMARY
KEY
,
INDEX
idx
(
i
)
)
ENGINE
=
INNODB
;
INSERT
INTO
t2
VALUES
(
-
1993998336
,
20
),(
-
1036582912
,
1
),(
-
733413376
,
5
),(
-
538247168
,
16
),
(
-
514260992
,
4
),(
-
249561088
,
9
),(
1
,
2
),(
1
,
6
),(
2
,
10
),(
2
,
19
),(
4
,
17
),
(
5
,
14
),(
5
,
15
),(
6
,
8
),(
7
,
13
),(
8
,
18
),(
9
,
11
),(
9
,
12
),(
257425408
,
7
),
(
576061440
,
3
);
EXPLAIN
SELECT
t1
.
i
AS
f
FROM
t1
,
t2
WHERE
t2
.
i
=
t1
.
pk
AND
t1
.
pk
BETWEEN
0
AND
224
HAVING
f
>
7
ORDER
BY
f
;
SELECT
t1
.
i
AS
f
FROM
t1
,
t2
WHERE
t2
.
i
=
t1
.
pk
AND
t1
.
pk
BETWEEN
0
AND
224
HAVING
f
>
7
ORDER
BY
f
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.3
tests
sql/opt_index_cond_pushdown.cc
View file @
6e5bcca7
...
...
@@ -318,7 +318,7 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok)
if
(
idx_cond
)
{
Item
*
idx_remainder_cond
=
0
;
tab
->
pre_idx_push_select_cond
=
tab
->
select
_
cond
;
tab
->
pre_idx_push_select_cond
=
tab
->
select
->
cond
;
/*
For BKA cache we store condition to special BKA cache field
because evaluation of the condition requires additional operations
...
...
sql/sql_select.cc
View file @
6e5bcca7
...
...
@@ -2213,6 +2213,14 @@ JOIN::exec()
DBUG_VOID_RETURN
;
curr_table
->
select
->
cond
->
fix_fields
(
thd
,
0
);
}
if
(
curr_table
->
pre_idx_push_select_cond
)
{
if
(
!
(
curr_table
->
pre_idx_push_select_cond
=
new
Item_cond_and
(
curr_table
->
pre_idx_push_select_cond
,
sort_table_cond
)))
DBUG_VOID_RETURN
;
curr_table
->
pre_idx_push_select_cond
->
fix_fields
(
thd
,
0
);
}
curr_table
->
set_select_cond
(
curr_table
->
select
->
cond
,
__LINE__
);
curr_table
->
select_cond
->
top_level_item
();
DBUG_EXECUTE
(
"where"
,
print_where
(
curr_table
->
select
->
cond
,
...
...
@@ -6355,6 +6363,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *temp_table)
join_tab
->
do_firstmatch
=
NULL
;
join_tab
->
loosescan_match_tab
=
NULL
;
join_tab
->
emb_sj_nest
=
NULL
;
join_tab
->
pre_idx_push_select_cond
=
NULL
;
bzero
((
char
*
)
&
join_tab
->
read_record
,
sizeof
(
join_tab
->
read_record
));
temp_table
->
status
=
0
;
temp_table
->
null_row
=
0
;
...
...
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