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
8dbedc9f
Commit
8dbedc9f
authored
Jan 13, 2006
by
evgen@moonbone.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
026e3984
605f62fc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
3 deletions
+42
-3
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+2
-0
mysql-test/r/select.result
mysql-test/r/select.result
+13
-0
mysql-test/t/select.test
mysql-test/t/select.test
+14
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+8
-3
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+5
-0
No files found.
mysql-test/r/func_group.result
View file @
8dbedc9f
...
@@ -865,6 +865,7 @@ select 1, min(a) from t1m where 1=99;
...
@@ -865,6 +865,7 @@ select 1, min(a) from t1m where 1=99;
1 NULL
1 NULL
select 1, min(1) from t1m where a=99;
select 1, min(1) from t1m where a=99;
1 min(1)
1 min(1)
1 NULL
select 1, min(1) from t1m where 1=99;
select 1, min(1) from t1m where 1=99;
1 min(1)
1 min(1)
1 NULL
1 NULL
...
@@ -876,6 +877,7 @@ select 1, max(a) from t1m where 1=99;
...
@@ -876,6 +877,7 @@ select 1, max(a) from t1m where 1=99;
1 NULL
1 NULL
select 1, max(1) from t1m where a=99;
select 1, max(1) from t1m where a=99;
1 max(1)
1 max(1)
1 NULL
select 1, max(1) from t1m where 1=99;
select 1, max(1) from t1m where 1=99;
1 max(1)
1 max(1)
1 NULL
1 NULL
...
...
mysql-test/r/select.result
View file @
8dbedc9f
...
@@ -3337,6 +3337,19 @@ id select_type table type possible_keys key key_len ref rows Extra
...
@@ -3337,6 +3337,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
DROP TABLE t1,t2,t3;
DROP TABLE t1,t2,t3;
create table t1 (f1 int unique);
create table t2 (f2 int unique);
create table t3 (f3 int unique);
insert into t1 values(1),(2);
insert into t2 values(1),(2);
insert into t3 values(1),(NULL);
select * from t3 where f3 is null;
f3
NULL
select t2.f2 from t1 left join t2 on f1=f2 join t3 on f1=f3 where f1=1;
f2
1
drop table t1,t2,t3;
create table t1(f1 char, f2 char not null);
create table t1(f1 char, f2 char not null);
insert into t1 values(null,'a');
insert into t1 values(null,'a');
create table t2 (f2 char not null);
create table t2 (f2 char not null);
...
...
mysql-test/t/select.test
View file @
8dbedc9f
...
@@ -2806,6 +2806,20 @@ EXPLAIN SELECT t2.key_a,foo
...
@@ -2806,6 +2806,20 @@ EXPLAIN SELECT t2.key_a,foo
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Bug #15633 Evaluation of Item_equal for non-const table caused wrong
# select result
#
create
table
t1
(
f1
int
unique
);
create
table
t2
(
f2
int
unique
);
create
table
t3
(
f3
int
unique
);
insert
into
t1
values
(
1
),(
2
);
insert
into
t2
values
(
1
),(
2
);
insert
into
t3
values
(
1
),(
NULL
);
select
*
from
t3
where
f3
is
null
;
select
t2
.
f2
from
t1
left
join
t2
on
f1
=
f2
join
t3
on
f1
=
f3
where
f1
=
1
;
drop
table
t1
,
t2
,
t3
;
#
#
# Bug#15268 Unchecked null value caused server crash
# Bug#15268 Unchecked null value caused server crash
#
#
...
...
sql/item_cmpfunc.cc
View file @
8dbedc9f
...
@@ -3765,6 +3765,7 @@ void Item_equal::update_used_tables()
...
@@ -3765,6 +3765,7 @@ void Item_equal::update_used_tables()
longlong
Item_equal
::
val_int
()
longlong
Item_equal
::
val_int
()
{
{
Item_field
*
item_field
;
if
(
cond_false
)
if
(
cond_false
)
return
0
;
return
0
;
List_iterator_fast
<
Item_field
>
it
(
fields
);
List_iterator_fast
<
Item_field
>
it
(
fields
);
...
@@ -3772,10 +3773,14 @@ longlong Item_equal::val_int()
...
@@ -3772,10 +3773,14 @@ longlong Item_equal::val_int()
if
((
null_value
=
item
->
null_value
))
if
((
null_value
=
item
->
null_value
))
return
0
;
return
0
;
eval_item
->
store_value
(
item
);
eval_item
->
store_value
(
item
);
while
((
item
=
it
++
))
while
((
item
_field
=
it
++
))
{
{
if
((
null_value
=
item
->
null_value
)
||
eval_item
->
cmp
(
item
))
/* Skip fields of non-const tables. They haven't been read yet */
return
0
;
if
(
item_field
->
field
->
table
->
const_table
)
{
if
((
null_value
=
item_field
->
null_value
)
||
eval_item
->
cmp
(
item_field
))
return
0
;
}
}
}
return
1
;
return
1
;
}
}
...
...
sql/item_cmpfunc.h
View file @
8dbedc9f
...
@@ -1150,6 +1150,11 @@ public:
...
@@ -1150,6 +1150,11 @@ public:
are deleted in the end of execution. All changes made to these
are deleted in the end of execution. All changes made to these
objects need not be registered in the list of changes of the parse
objects need not be registered in the list of changes of the parse
tree and do not harm PS/SP re-execution.
tree and do not harm PS/SP re-execution.
Item equal objects are employed only at the optimize phase. Usually they are
not supposed to be evaluated. Yet in some cases we call the method val_int()
for them. We have to take care of restricting the predicate such an
object represents f1=f2= ...=fn to the projection of known fields fi1=...=fik.
*/
*/
class
Item_equal
:
public
Item_bool_func
class
Item_equal
:
public
Item_bool_func
...
...
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