List:Commits« Previous MessageNext Message »
From:Roy Lyseng Date:December 1 2010 11:22am
Subject:Re: bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525
View as plain text  
Hi Jørgen,

On 01.12.10 09.41, Jorgen Loland wrote:
> Roy,
>
> thank you for the patch. I agree to the logic of setting OUTER_REF_TABLE_BIT in
> all selects that have subselects with outer dependencies. However, I wonder if
> this is the correct place to fix the bug. See comment below.
>
>  > === modified file 'sql/item.cc'
>  > --- a/sql/item.cc 2010-11-14 18:09:32 +0000
>  > +++ b/sql/item.cc 2010-11-18 09:47:04 +0000
>  > @@ -2359,17 +2366,16 @@ void Item_field::fix_after_pullout(st_se
>  > */
>  > st_select_lex *child_select= context->select_lex;
>  >
>  > - if (child_select->outer_select() != depended_from)
>  > + while (child_select->outer_select() != depended_from)
>  > {
>  > /*
>  > The subquery on this level is outer-correlated with respect to the field
>  > */
>  > Item_subselect *subq_predicate= child_select->master_unit()->item;
>  > - subq_predicate->used_tables_cache|= OUTER_REF_TABLE_BIT;
>  > - }
>  >
>  > - while (child_select->outer_select() != depended_from)
>  > + subq_predicate->used_tables_cache|= OUTER_REF_TABLE_BIT;
>  > child_select= child_select->outer_select();
>  > + }
>
> AFAIU, the problem in this bug was that SELECT C did not have ORTB set after
> semijoin transformation but with the patch it does:
>
> Before semijoin
> ---------------
> A - t1 <- OUTER_REF_TABLE_BIT not set
> \
> B - t2 <- OUTER_REF_TABLE_BIT not set
> \
> C - t3 <- OUTER_REF_TABLE_BIT not set
> \
> D - t4 <- ORTB set, depended_from points to A
> where t1.x=t4.y
>
>
> After semijoining B into A
> --------------------------
> A - t1, t2 <- OUTER_REF_TABLE_BIT not set
> \
> C - t3 <- pre-patch: OUTER_REF_TABLE_BIT not set
> \ post-patch: OUTER_REF_TABLE_BIT set
> D - t4 <- ORTB set, depended_from points to A
> where t1.x=t4.y
>
> With the logic that SELECT C should have ORTB set because it contains a
> subselect that has a dependency to ot1, wouldn't it be more correct to set this
> bit both for SELECT B and C during the prepare stage rather than during semijoin
> transformation?
>

Sorry for confusing you - the ORTB is indeed set for subquery predicates in 
SELECT B and C after initial resolver stage. So my patch just tries to preserve 
that information during fix_after_pullout() calls.

Thanks,
Roy
Thread
bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525Roy Lyseng18 Nov
  • Re: bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525Jorgen Loland1 Dec
    • Re: bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525Roy Lyseng1 Dec
      • Re: bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525Jorgen Loland1 Dec
  • Re: bzr commit into mysql-trunk branch (roy.lyseng:3287) Bug#57525Øystein Grøvlen20 Jan