1
0
mirror of https://github.com/MariaDB/server.git synced 2025-05-31 08:42:45 +03:00
Georgi Kodinov ac37324843 Bug #42116 : Mysql crash on specific query
Queries with nested outer joins may lead to crashes or 
bad results because an internal data structure is not handled
correctly.
The optimizer uses bitmaps of nested JOINs to determine
if certain table can be placed at a certain place in the
JOIN order.
It does maintain a bitmap describing in which JOINs 
last placed table is nested.
When it puts a table it makes sure the bit of every JOIN that
contains the table in question is set (because JOINs can be nested).
It does that by recursively setting the bit for the next enclosing
JOIN when this is the first table in the JOIN and recursively 
resetting the bit if it's the last table in the JOIN.
When it removes a table from the join order it should do the
opposite : recursively unset the bit if it's the only remaining 
table in this join and and recursively set the bit if it's removing
the last table of a JOIN.
There was an error in how the bits was set for the upper levels :
when removing a table it was setting the bit for all the enclosing 
nested JOINs even if there were more tables left in the current JOIN
(which practically means that the upper nested JOINs were not affected).
Fixed by stopping the recursion at the relevant level.

mysql-test/r/join.result:
  Bug #42116: test case
mysql-test/t/join.test:
  Bug #42116: test case
sql/sql_select.cc:
  Bug #41116: don't go up and set the bits if more tables in
  at the current JOIN level
2009-10-29 17:24:29 +02:00
..
2008-01-27 16:41:29 +01:00
2007-11-06 20:31:40 +02:00
2007-08-07 05:35:20 -04:00
2007-10-19 17:07:08 +02:00
2007-06-28 16:03:01 -07:00
2007-07-06 11:35:10 -07:00
2007-07-06 11:35:10 -07:00
2009-02-06 18:25:08 +01:00
2009-02-09 21:52:40 +01:00
2007-07-11 18:45:35 -07:00
2007-11-02 13:40:34 +03:00
2007-11-02 13:40:34 +03:00
2009-05-28 16:19:49 +05:00
2008-12-17 15:01:34 -05:00
2007-08-31 16:59:07 +05:00
2007-11-05 20:18:22 +01:00
2007-10-26 08:42:33 +02:00
2008-01-27 16:41:29 +01:00
2007-11-05 20:18:22 +01:00
2008-01-22 14:18:47 +01:00
2007-11-20 20:15:20 +04:00
2009-02-25 11:37:30 +01:00
2007-11-30 18:06:28 +01:00
2008-08-22 19:49:51 +02:00
2008-04-04 01:16:55 +04:00
2008-04-04 01:16:55 +04:00
2009-07-03 10:19:32 +02:00
2007-06-06 18:55:21 +05:00
2007-07-22 18:26:16 -07:00
2008-03-14 20:51:32 +01:00
2008-02-07 02:33:21 +04:00