Bug #10944 FIELD function returns incorrect result in version 4.1.x
Submitted: 29 May 2005 18:42 Modified: 20 Jun 2005 22:18
Reporter: Yunliang Yu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.x OS:Linux (linux 2.6.x)
Assigned to: Jim Winstead CPU Architecture:Any

[29 May 2005 18:42] Yunliang Yu
Description:
The FIELD function in 4.1.x seems to be broken, while it worked fine back in 4.0.x. For example,

mysql> select FIELD(0,NULL,NULL,0);

Your MySQL connection id is 3 to server version: 4.1.12-log
+----------------------+
| FIELD(0,NULL,NULL,0) |
+----------------------+
|                    1         |
+----------------------+

Your MySQL connection id is 412 to server version: 4.0.24-log
+----------------------+
| FIELD(0,NULL,NULL,0) |
+----------------------+
|                    3         |
+----------------------+

Thanks.
-yu

How to repeat:
select FIELD(0,NULL,NULL,0);
[30 May 2005 6:34] Jorge del Conde
Thanks for your bug report.  I got the same errors that you did using 4.1.13 & 5.0.7 both from our development tree versions.
[1 Jun 2005 0:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25425
[1 Jun 2005 16:47] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25472
[2 Jun 2005 1:11] Jim Winstead
Fixed in 4.1.13 and 5.0.7.
[20 Jun 2005 22:18] Mike Hillyer
Documented in 5.0.7 and 4.1.13 changelogs:

<listitem><para>
 Fixed bug in <literal>FIELD()</literal> function where value list contains <literal>NULL</literal>. (Bug #10944)
</para></listitem>