LGTM
On 05/26/2011 06:24 PM, Guilhem Bichot wrote:
> [This commit e-mail is a repeat.]
>
> #At file:///home/mysql_src/bzrrepos_new/mysql-next-mr-opt-backporting-wl4800/ based
> on revid:guilhem.bichot@stripped
>
> 3315 Guilhem Bichot 2011-05-26
> fix for BUG#12595210 - JSON SYNTAX ERROR ASSERT ON WHERE FIELD NOT IN
> SUBQUERY
> @ mysql-test/suite/optimizer_trace/t/optimizer_trace_bugs.test
> test for bug; used to crash. BUG 12595688 was filed along the way.
> @ sql/item_subselect.cc
> when doing IN->EXISTS transformation of IN(select),
> if "select" contains some constant WHERE/HAVING clause we may evaluate it;
> this may evaluate a subquery (if the WHERE/HAVING has a subquery). This
> caused
> a syntax error like this:
> {
> "transformation": {
> "select#": 2,
> "from": "IN (SELECT)",
> "to": "EXISTS (CORRELATED SELECT)",
> "chosen": true** invalid JSON (missing key) ** ,
> "?": {
> "subselect_execution": {
> "select#": 3,
> Where:
> "subselect_execution" and its outer unnamed object come from
> join->conds->fix_fields()
> called in Item_in_subselect::row_value_in_to_exists_transformer()
> (transforming select#2 with IN->EXISTS, evaluating its WHERE clause along
> the way,
> which means evaluating the constant select#3).
> The fix is to open a named object when about to evaluate the constant
> WHERE,
> so that subquery execution fits into it.
> Same for HAVING.
> Same for transformations of returning-single-column subqueries.
>
> modified:
> mysql-test/suite/optimizer_trace/r/optimizer_trace2_no_prot.result
> mysql-test/suite/optimizer_trace/r/optimizer_trace_bugs.result
> mysql-test/suite/optimizer_trace/r/optimizer_trace_no_prot.result
> mysql-test/suite/optimizer_trace/r/optimizer_trace_ps_prot.result
> mysql-test/suite/optimizer_trace/r/optimizer_trace_range_no_prot.result
> mysql-test/suite/optimizer_trace/t/optimizer_trace_bugs.test
> sql/item_subselect.cc
--
Jørgen Løland | Senior Software Engineer | +47 73842138
Oracle MySQL
Trondheim, Norway