From: Roy Lyseng Date: October 13 2010 1:09pm Subject: Re: bzr commit into mysql-next-mr-bugfixing branch (jorgen.loland:3262) Bug#52329 List-Archive: http://lists.mysql.com/commits/120684 Message-Id: <4CB5AF7E.2090004@oracle.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------070104050607020503030904" --------------070104050607020503030904 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Approved. I think Øystein's suggestion for test cases is reasonable. Otherwise, I have one comment to the commit header, see below. Thanks, Roy On 13.10.10 13.38, Jorgen Loland wrote: > #At file:///export/home/jl208045/mysql/mysql-next-mr-opt-backporting-52329/ based on revid:tor.didriksen@stripped > > 3262 Jorgen Loland 2010-10-13 > Bug#52329: Wrong result: subquery materialization, IN, non-null > field followed by nullable > > Consider a query > > SELECT * FROM t1 > WHERE (a1, a2) IN ( > SELECT b1, b2 FROM t2 ...) > > When solved using materialized subselect, we check if a record > from t1 is part of the result set by constructing a key from the > a1 and a2 values and perform a lookup based on that key. If a1 > and a2 are CHAR(3) with values foo and bar, the KEY is "foobar". > If a2 is NULLable, the null-bit should be the first bit for this > field's part of the KEY ("foobar"). You probably mean null-byte, and not null-bit? > > Before, the null-bit pointer for each key field wrongly pointed > to the first bit of the KEY instead of the first bit of the key > part. Thus, when setting the null bit for a2 above, the first bit > of a1 was wrongly updated: "0oo bar" ('f' in foo replaced > with null-bit of a2, and the null-bit of a2 not set) > > This patch sets the null-pointer for each key part to the first > bit of that field's part of KEY, not the first bit of KEY. > > The bug was masked if the first field was NOT NULL. The bug also > applied to semi-join materialization since the code has been > copied (also fixed by this patch). > > > > --------------070104050607020503030904--