diff options
author | unknown <igor@olga.mysql.com> | 2007-04-17 17:35:29 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-04-17 17:35:29 -0700 |
commit | 579c2bff63fb8833226d86afb6ac2eab0ead9737 (patch) | |
tree | 1a362500b07f089c987ba9c60f49ff00e1cea650 /sql/item_subselect.h | |
parent | 3e8252ffc6ff28df8b0dbadcfea6ca506a731cbf (diff) | |
download | mariadb-git-579c2bff63fb8833226d86afb6ac2eab0ead9737.tar.gz |
Fixed bug #27870. The bug that causes crashes manifests itself at some
conditions when executing an equijoin query with WHERE condition
containing a subquery predicate of the form join_attr NOT IN (SELECT ...).
To resolve a problem of the correct evaluation of the expression
attr NOT IN (SELECT ...)
an array of guards is created to make it possible to filter out some
predicates of the EXISTS subquery into which the original subquery
predicate is transformed, in the cases when a takes the NULL value.
If attr is defined as a field that cannot be NULL than such an array
is not needed and is not created.
However if the field a occurred also an an equijoin predicate t2.a=t1.b
and table t1 is accessed before table t2 then it may happen that the
the EXISTS subquery is pushed down to the condition evaluated just after
table t1 has been accessed. In this case any occurrence of t2.a is
substituted for t1.b. When t1.b takes the value of NULL an attempt is
made to turn on the corresponding guard. This action caused a crash as
no guard array had been created.
Now the code of Item_in_subselect::set_cond_guard_var checks that the guard
array has been created before setting a guard variable on. Otherwise the
method does nothing. It cannot results in returning a row that could be
rejected as the condition t2.a=t1.b will be checked later anyway.
mysql-test/r/subselect3.result:
Added a test case for bug #27870.
mysql-test/t/subselect3.test:
Added a test case for bug #27870.
sql/item_subselect.h:
Fixed bug #27870. The bug that causes crashes manifests itself at some
conditions when executing an equijoin query with WHERE condition
containing a subquery predicate of the form join_attr NOT IN (SELECT ...).
Forced Item_in_subselect::set_cond_guard_var to check that the guard
array has been created before setting a guard variable on. Otherwise the
method does nothing.
Diffstat (limited to 'sql/item_subselect.h')
-rw-r--r-- | sql/item_subselect.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/item_subselect.h b/sql/item_subselect.h index 6b605e96432..118609671b8 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -276,7 +276,11 @@ public: { return pushed_cond_guards ? pushed_cond_guards + i : NULL; } - void set_cond_guard_var(int i, bool v) { pushed_cond_guards[i]= v; } + void set_cond_guard_var(int i, bool v) + { + if ( pushed_cond_guards) + pushed_cond_guards[i]= v; + } bool have_guarded_conds() { return test(pushed_cond_guards); } Item_func_not_all *upper_item; // point on NOT/NOP before ALL/SOME subquery |