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
89cabf04
Commit
89cabf04
authored
Jun 28, 2005
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
parents
8b0cee88
451faae3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
mysql-test/r/range.result
mysql-test/r/range.result
+24
-0
mysql-test/t/range.test
mysql-test/t/range.test
+23
-0
sql/opt_range.cc
sql/opt_range.cc
+6
-5
No files found.
mysql-test/r/range.result
View file @
89cabf04
...
...
@@ -720,3 +720,27 @@ id status
59 C
60 C
DROP TABLE t1;
CREATE TABLE t1 (a int, b int, primary key(a,b));
INSERT INTO t1 VALUES
(1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3);
CREATE VIEW v1 as SELECT a,b FROM t1 WHERE b=3;
EXPLAIN SELECT a,b FROM t1 WHERE a < 2 and b=3;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
EXPLAIN SELECT a,b FROM t1 WHERE a < 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
EXPLAIN SELECT a,b FROM v1 WHERE a < 2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index
SELECT a,b FROM t1 WHERE a < 2 and b=3;
a b
1 3
SELECT a,b FROM v1 WHERE a < 2 and b=3;
a b
1 3
DROP VIEW v1;
DROP TABLE t1;
mysql-test/t/range.test
View file @
89cabf04
...
...
@@ -530,3 +530,26 @@ SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B';
SELECT
*
FROM
t1
WHERE
status
<
'A'
OR
status
>
'B'
;
DROP
TABLE
t1
;
#
# Test for bug #10031: range to be used over a view
#
CREATE
TABLE
t1
(
a
int
,
b
int
,
primary
key
(
a
,
b
));
INSERT
INTO
t1
VALUES
(
1
,
1
),(
1
,
2
),(
1
,
3
),(
2
,
1
),(
2
,
2
),(
2
,
3
),(
3
,
1
),(
3
,
2
),(
3
,
3
),(
4
,
1
),(
4
,
2
),(
4
,
3
);
CREATE
VIEW
v1
as
SELECT
a
,
b
FROM
t1
WHERE
b
=
3
;
EXPLAIN
SELECT
a
,
b
FROM
t1
WHERE
a
<
2
and
b
=
3
;
EXPLAIN
SELECT
a
,
b
FROM
v1
WHERE
a
<
2
and
b
=
3
;
EXPLAIN
SELECT
a
,
b
FROM
t1
WHERE
a
<
2
;
EXPLAIN
SELECT
a
,
b
FROM
v1
WHERE
a
<
2
;
SELECT
a
,
b
FROM
t1
WHERE
a
<
2
and
b
=
3
;
SELECT
a
,
b
FROM
v1
WHERE
a
<
2
and
b
=
3
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
sql/opt_range.cc
View file @
89cabf04
...
...
@@ -3581,15 +3581,16 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
DBUG_RETURN
(
ftree
);
}
default:
if
(
cond_func
->
arguments
()[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
if
(
cond_func
->
arguments
()[
0
]
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
{
field_item
=
(
Item_field
*
)
(
cond_func
->
arguments
()[
0
]);
field_item
=
(
Item_field
*
)
(
cond_func
->
arguments
()[
0
]
->
real_item
()
);
value
=
cond_func
->
arg_count
>
1
?
cond_func
->
arguments
()[
1
]
:
0
;
}
else
if
(
cond_func
->
have_rev_func
()
&&
cond_func
->
arguments
()[
1
]
->
type
()
==
Item
::
FIELD_ITEM
)
cond_func
->
arguments
()[
1
]
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
{
field_item
=
(
Item_field
*
)
(
cond_func
->
arguments
()[
1
]);
field_item
=
(
Item_field
*
)
(
cond_func
->
arguments
()[
1
]
->
real_item
()
);
value
=
cond_func
->
arguments
()[
0
];
}
else
...
...
@@ -3610,7 +3611,7 @@ static SEL_TREE *get_mm_tree(PARAM *param,COND *cond)
for
(
uint
i
=
0
;
i
<
cond_func
->
arg_count
;
i
++
)
{
Item
*
arg
=
cond_func
->
arguments
()[
i
];
Item
*
arg
=
cond_func
->
arguments
()[
i
]
->
real_item
()
;
if
(
arg
!=
field_item
)
ref_tables
|=
arg
->
used_tables
();
}
...
...
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