25.10.2011 19:54, Sergei Petrunia пишет:
On Tue, Oct 25, 2011 at 11:59:37AM +0300, sanja@askmonty.org wrote:
At file:///home/bell/maria/bzr/work-maria-5.3-lpb872775/
------------------------------------------------------------ revno: 3249 revision-id: sanja@askmonty.org-20111025085936-h0jyyxtbv3qhp4f4 parent: igor@askmonty.org-20111023124603-sjv665ajk25b4dgi committer: sanja@askmonty.org branch nick: work-maria-5.3-lpb872775 timestamp: Tue 2011-10-25 11:59:36 +0300 message: Fix of LP BUG#872775.
The problem was that merged views has its own nest_level numbering => when we compare nest levels we should take into considiration basis (i.e. 0 level), if it is different then nest levels are not comparable. :grep nest_level_base *.h *.c* item.h|1165| st_select_lex_unit *nest_level_base; sql_lex.h|687| SELECT_LEX_UNIT *nest_level_base; /* unit from which we count nest_level */ item.cc|759| depended_from->nest_level_base == prm->nest_level_base&& item_subselect.cc|603| unit->first_select()->nest_level_base, item_sum.cc|363| ds->nest_level_base == prm->nest_level_base&& sql_lex.cc|342| lex->select_lex.nest_level_base=&lex->unit; sql_parse.cc|5920| select_lex->nest_level_base=&thd->lex->unit;
The only places where nest_level_base is assigned are:
sql_lex.cc|342| lex->select_lex.nest_level_base=&lex->unit; sql_parse.cc|5920| select_lex->nest_level_base=&thd->lex->unit;
both of these initialize it to the top-level unit. So what is the point of having nest_level_base in this case? Please clarify :)
It assign the top level UNIT (first for "main" SELECT, second for every other SELECT), but top level UNIT is different for main query and each view (each view parsed as separate SELECT with its own LEX and main UNIT and SELECT in it) [skip]