| Bug #6319 | not clear documented behaviour, string function FIELD(NULL,.....) | ||
|---|---|---|---|
| Submitted: | 29 Oct 2004 10:46 | Modified: | 29 Oct 2004 14:42 |
| Reporter: | Matthias Leich | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
| Version: | OS: | ||
| Assigned to: | Paul DuBois | CPU Architecture: | Any |
[29 Oct 2004 14:42]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant product(s). Additional info: NULL = any value is not TRUE so NULL is "not found". FIELD() returns 0. I've updated the manual to indicate this.

Description: The manual says: FIELD(str,str1,str2,str3,...) Returns the index of str in the str1, str2, str3, ... list. Returns 0 if str is not found. FIELD() is the complement of ELT(). I miss a clear description what result I will get when the first parameter is NULL. Somebody could expect a - NULL, because we cannot decide if a unknown string matches known strings or - 0, because the try to find a matching string was not successful. The current behaviour is: select FIELD( NULL,'1it','Hit','3it') as my_column ; my_column 0 select FIELD( NULL,'1it',NULL,'3it') as my_column ; my_column 0 How to repeat: Please execute the statements above