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
9ea133fb
Commit
9ea133fb
authored
Sep 23, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
3b31fbb5
ebbdb14a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
2 deletions
+98
-2
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+17
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+17
-0
mysql-test/t/subselect_sj.test
mysql-test/t/subselect_sj.test
+21
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+36
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+4
-0
sql/item_row.cc
sql/item_row.cc
+2
-0
sql/item_subselect.cc
sql/item_subselect.cc
+1
-2
No files found.
mysql-test/r/subselect_sj.result
View file @
9ea133fb
...
...
@@ -1903,4 +1903,21 @@ a a
EXECUTE st1;
a a
DROP TABLE t1, t2, t3;
#
# BUG#849776: Wrong result with semijoin + "Impossible where"
#
CREATE TABLE t1 ( b varchar(1), a integer) ;
INSERT INTO t1 VALUES ('z',8);
CREATE TABLE t2 ( a integer, b varchar(1)) ;
CREATE TABLE t4 ( a integer, b varchar(1)) ;
CREATE TABLE t5 ( a integer) ;
INSERT INTO t5 VALUES (8);
select * from t5 where (a) in (
SELECT t1.a
FROM t1 LEFT JOIN t2 ON t1.a = t2.a
WHERE t2.b NOT IN (SELECT t4.b FROM t4 WHERE t4.b < t1.b)
);
a
8
DROP TABLE t1, t2, t4, t5;
set optimizer_switch=@subselect_sj_tmp;
mysql-test/r/subselect_sj_jcl6.result
View file @
9ea133fb
...
...
@@ -1914,6 +1914,23 @@ a a
EXECUTE st1;
a a
DROP TABLE t1, t2, t3;
#
# BUG#849776: Wrong result with semijoin + "Impossible where"
#
CREATE TABLE t1 ( b varchar(1), a integer) ;
INSERT INTO t1 VALUES ('z',8);
CREATE TABLE t2 ( a integer, b varchar(1)) ;
CREATE TABLE t4 ( a integer, b varchar(1)) ;
CREATE TABLE t5 ( a integer) ;
INSERT INTO t5 VALUES (8);
select * from t5 where (a) in (
SELECT t1.a
FROM t1 LEFT JOIN t2 ON t1.a = t2.a
WHERE t2.b NOT IN (SELECT t4.b FROM t4 WHERE t4.b < t1.b)
);
a
8
DROP TABLE t1, t2, t4, t5;
set optimizer_switch=@subselect_sj_tmp;
#
# BUG#49129: Wrong result with IN-subquery with join_cache_level=6 and firstmatch=off
...
...
mysql-test/t/subselect_sj.test
View file @
9ea133fb
...
...
@@ -1735,5 +1735,26 @@ EXECUTE st1;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# BUG#849776: Wrong result with semijoin + "Impossible where"
--
echo
#
CREATE
TABLE
t1
(
b
varchar
(
1
),
a
integer
)
;
INSERT
INTO
t1
VALUES
(
'z'
,
8
);
CREATE
TABLE
t2
(
a
integer
,
b
varchar
(
1
))
;
CREATE
TABLE
t4
(
a
integer
,
b
varchar
(
1
))
;
CREATE
TABLE
t5
(
a
integer
)
;
INSERT
INTO
t5
VALUES
(
8
);
select
*
from
t5
where
(
a
)
in
(
SELECT
t1
.
a
FROM
t1
LEFT
JOIN
t2
ON
t1
.
a
=
t2
.
a
WHERE
t2
.
b
NOT
IN
(
SELECT
t4
.
b
FROM
t4
WHERE
t4
.
b
<
t1
.
b
)
);
DROP
TABLE
t1
,
t2
,
t4
,
t5
;
# The following command must be the last one the file
set
optimizer_switch
=@
subselect_sj_tmp
;
sql/item_cmpfunc.cc
View file @
9ea133fb
...
...
@@ -1405,6 +1405,16 @@ bool Item_in_optimizer::is_top_level_item()
}
void
Item_in_optimizer
::
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
)
{
/* This will re-calculate attributes of our Item_in_subselect: */
Item_bool_func
::
fix_after_pullout
(
new_parent
,
ref
);
/* Then, re-calculate not_null_tables_cache: */
eval_not_null_tables
(
NULL
);
}
bool
Item_in_optimizer
::
eval_not_null_tables
(
uchar
*
opt_arg
)
{
not_null_tables_cache
=
0
;
...
...
@@ -2136,6 +2146,14 @@ bool Item_func_between::eval_not_null_tables(uchar *opt_arg)
}
void
Item_func_between
::
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
)
{
/* This will re-calculate attributes of the arguments */
Item_func_opt_neg
::
fix_after_pullout
(
new_parent
,
ref
);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables
(
NULL
);
}
void
Item_func_between
::
fix_length_and_dec
()
{
THD
*
thd
=
current_thd
;
...
...
@@ -2516,6 +2534,16 @@ Item_func_if::eval_not_null_tables(uchar *opt_arg)
return
0
;
}
void
Item_func_if
::
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
)
{
/* This will re-calculate attributes of the arguments */
Item_func
::
fix_after_pullout
(
new_parent
,
ref
);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables
(
NULL
);
}
void
Item_func_if
::
fix_length_and_dec
()
{
...
...
@@ -3760,6 +3788,14 @@ Item_func_in::eval_not_null_tables(uchar *opt_arg)
}
void
Item_func_in
::
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
)
{
/* This will re-calculate attributes of the arguments */
Item_func_opt_neg
::
fix_after_pullout
(
new_parent
,
ref
);
/* Then, re-calculate not_null_tables_cache according to our special rules */
eval_not_null_tables
(
NULL
);
}
static
int
srtcmp_in
(
CHARSET_INFO
*
cs
,
const
String
*
x
,
const
String
*
y
)
{
return
cs
->
coll
->
strnncollsp
(
cs
,
...
...
sql/item_cmpfunc.h
View file @
9ea133fb
...
...
@@ -262,6 +262,7 @@ public:
virtual
void
get_cache_parameters
(
List
<
Item
>
&
parameters
);
bool
is_top_level_item
();
bool
eval_not_null_tables
(
uchar
*
opt_arg
);
void
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
);
};
class
Comp_creator
...
...
@@ -674,6 +675,7 @@ public:
CHARSET_INFO
*
compare_collation
()
{
return
cmp_collation
.
collation
;
}
uint
decimal_precision
()
const
{
return
1
;
}
bool
eval_not_null_tables
(
uchar
*
opt_arg
);
void
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
);
};
...
...
@@ -775,6 +777,7 @@ public:
uint
decimal_precision
()
const
;
const
char
*
func_name
()
const
{
return
"if"
;
}
bool
eval_not_null_tables
(
uchar
*
opt_arg
);
void
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
);
};
...
...
@@ -1313,6 +1316,7 @@ public:
bool
is_bool_func
()
{
return
1
;
}
CHARSET_INFO
*
compare_collation
()
{
return
cmp_collation
.
collation
;
}
bool
eval_not_null_tables
(
uchar
*
opt_arg
);
void
fix_after_pullout
(
st_select_lex
*
new_parent
,
Item
**
ref
);
};
class
cmp_item_row
:
public
cmp_item
...
...
sql/item_row.cc
View file @
9ea133fb
...
...
@@ -149,11 +149,13 @@ void Item_row::fix_after_pullout(st_select_lex *new_parent, Item **ref)
{
used_tables_cache
=
0
;
const_item_cache
=
1
;
not_null_tables_cache
=
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
items
[
i
]
->
fix_after_pullout
(
new_parent
,
&
items
[
i
]);
used_tables_cache
|=
items
[
i
]
->
used_tables
();
const_item_cache
&=
items
[
i
]
->
const_item
();
not_null_tables_cache
|=
items
[
i
]
->
not_null_tables
();
}
}
...
...
sql/item_subselect.cc
View file @
9ea133fb
...
...
@@ -2477,8 +2477,7 @@ void Item_in_subselect::fix_after_pullout(st_select_lex *new_parent, Item **ref)
{
left_expr
->
fix_after_pullout
(
new_parent
,
&
left_expr
);
Item_subselect
::
fix_after_pullout
(
new_parent
,
ref
);
//psergey-todo: the above looks odd, why don't we 'aggregate' left_expr with
//the rest?
used_tables_cache
|=
left_expr
->
used_tables
();
}
void
Item_in_subselect
::
update_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