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
8aaf9197
Commit
8aaf9197
authored
Mar 15, 2011
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
3f944c43
633dbc3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
2 deletions
+54
-2
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+22
-0
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/innodb/t/innodb_mysql.test
+23
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-2
No files found.
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
8aaf9197
...
...
@@ -2785,4 +2785,26 @@ DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
DROP TABLE IF EXISTS t1, t2;
#
# Bug#702322: HAVING with two ANDed predicates + ORDER BY
#
CREATE TABLE t1 (pk int PRIMARY KEY, a int, KEY (a)) ENGINE=InnoDB;
CREATE TABLE t2 (a int, KEY (a)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(18,0),(9,10),(8,11),(2,15),(7,19),(1,20);
SET SESSION join_cache_level = 0;
EXPLAIN
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
ORDER BY t1.a;
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 a a 5 test.t1.pk 1 Using index
SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.pk = t2.a
WHERE t1.pk >= 6 HAVING t1.a<> 0 AND t1.a <> 11
ORDER BY t1.a;
a
10
19
DROP TABLE t1,t2;
End of 5.3 tests
mysql-test/suite/innodb/t/innodb_mysql.test
View file @
8aaf9197
...
...
@@ -984,6 +984,7 @@ DROP TABLE t1, t2;
--
echo
# Test for bug #56619 - Assertion failed during
--
echo
# ALTER TABLE RENAME, DISABLE KEYS
--
echo
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
...
...
@@ -993,4 +994,26 @@ ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
--
echo
#
--
echo
# Bug#702322: HAVING with two ANDed predicates + ORDER BY
--
echo
#
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
a
int
,
KEY
(
a
))
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
a
int
,
KEY
(
a
))
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
18
,
0
),(
9
,
10
),(
8
,
11
),(
2
,
15
),(
7
,
19
),(
1
,
20
);
SET
SESSION
join_cache_level
=
0
;
EXPLAIN
SELECT
t1
.
a
FROM
t1
LEFT
JOIN
t2
ON
t1
.
pk
=
t2
.
a
WHERE
t1
.
pk
>=
6
HAVING
t1
.
a
<>
0
AND
t1
.
a
<>
11
ORDER
BY
t1
.
a
;
SELECT
t1
.
a
FROM
t1
LEFT
JOIN
t2
ON
t1
.
pk
=
t2
.
a
WHERE
t1
.
pk
>=
6
HAVING
t1
.
a
<>
0
AND
t1
.
a
<>
11
ORDER
BY
t1
.
a
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.3
tests
sql/sql_select.cc
View file @
8aaf9197
...
...
@@ -2315,16 +2315,23 @@ JOIN::exec()
new
Item_cond_and
(
curr_table
->
select
->
cond
,
sort_table_cond
)))
DBUG_VOID_RETURN
;
curr_table
->
select
->
cond
->
fix_fields
(
thd
,
0
);
}
if
(
curr_table
->
pre_idx_push_select_cond
)
{
if
(
sort_table_cond
->
type
()
==
Item
::
COND_ITEM
&&
sort_table_cond
!=
curr_table
->
select
->
cond
)
sort_table_cond
=
sort_table_cond
->
copy_andor_structure
(
thd
);
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
);
}
if
(
curr_table
->
select
->
cond
&&
!
curr_table
->
select
->
cond
->
fixed
)
curr_table
->
select
->
cond
->
fix_fields
(
thd
,
0
);
if
(
curr_table
->
pre_idx_push_select_cond
&&
!
curr_table
->
pre_idx_push_select_cond
->
fixed
)
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
,
...
...
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