Bug #8397 crash, DECIMAL column = NULL in outer query
Submitted: 9 Feb 2005 15:38 Modified: 7 Mar 2005 21:53
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0 OS:
Assigned to: Sergey Petrunya CPU Architecture:Any

[9 Feb 2005 15:38] Matthias Leich
I get a server crash under the following conditions:
 - The outer query contains a record with a DECIMAL column(HOURS) containing NULL
 - The value of that DECIMAL column should be (with) IN the result of the inner query.
Properties NOT needed for the crash!!
   - The result of the inner query contains a record with HOURS IS NULL.
   - t2.HOURS has also the data type DECIMAL


BTW: It looks like this crash is result of the latest codes changes (5. - 9. February).

My environment:
   - Intel PC with Linux(SuSE 9.1)
   - MySQL compiled from source
        Version 5.0 ChangeSet@1.1840.1.8, 2005-02-09

How to repeat:
Please have a look into the attached test case ml20.test. I contains several variations of 
statements and comments.
Copy it to mysql-test/t
  ./mysql-test-run ml20
[9 Feb 2005 15:50] Matthias Leich
test case

Attachment: ml20.test (application/test, text), 3.23 KiB.

[9 Feb 2005 17:09] Jorge del Conde
Thanks for your bug report!
[17 Feb 2005 20:56] Sergey Petrunya
Comment re fix: 
In Item_cache_decimal::store(item) the call item->val_decimal_result() returns NULL if the passed item has an SQL null value. Don't try copying NULL into Item_cache_decimal::val in this case.

will change the cset comment to the above when pushing the fix.
[22 Feb 2005 19:23] Sergey Petrunya
Fixed in 5.0.3
Note to docs team: the bug happened on decimal column values passed out of subselects.
[7 Mar 2005 21:53] Paul Dubois
Noted in 5.0.3 changelog.