Bug #3367 Prepared statement "SELECT ?, ..." produces wrong result when parameter is NULL
Submitted: 2 Apr 2004 7:14 Modified: 29 Apr 2004 22:31
Reporter: Sergey Petrunya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1-bk OS:
Assigned to: Sergey Petrunya CPU Architecture:Any

[2 Apr 2004 7:14] Sergey Petrunya
Description:
Execution of prepared statement "SELECT ?, {whatever}" with NULL as corresponding parameter produces wrong output. 

The problem occurs only when "?" is directly in the output list:  "SELECT ?" produces wrong results while "SELECT ?+1" or produces correct result.

How to repeat:
Prepare statement "SELECT ?".
Execute it with integer NULL as parameter. 
Get -214783648 as result.
[2 Apr 2004 8:42] Sergey Petrunya
Additionally execution of "select ? + 1 from t" produces zeros regardless of parameter values passed.
[2 Apr 2004 11:18] Dean Ellis
Test Case #2

Attachment: bug3367-2.cc (text/x-c++), 1.26 KiB.

[12 Apr 2004 13:19] Sergey Petrunya
ChangeSet@1.1791, 2004-04-13 00:13:25+04:00, sergefp@mysql.com
  Fix and testcase for BUG#3367.
[29 Apr 2004 22:31] Sergey Petrunya
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html