Bug #6564 QUOTE(NULL) returns NULL, not the string 'NULL'
Submitted: 11 Nov 2004 0:06 Modified: 12 Nov 2004 9:21
Reporter: Paul DuBois Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0,4.1,5.0 OS:
Assigned to: Ramil Kalimullin CPU Architecture:Any

[11 Nov 2004 0:06] Paul DuBois
QUOTE() is supposed to always return a string so
that the result can be used in constructing SQL
statements.  In particular, QUOTE(NULL) should
return the string 'NULL' (without quotes).  But it
returns NULL instead.

How to repeat:
If you use this statement in mysql, you cannot
tell whether or not the result is a string:

| NULL        |
1 row in set (0.00 sec)

However, this sequence of statement reveals
that QUOTE(NULL) does indeed return NULL
and not a string:

mysql> select concat('a','NULL');
| concat('a','NULL') |
| aNULL              |
1 row in set (0.35 sec)

mysql> select concat('a',NULL);
| concat('a',NULL) |
| NULL             |
1 row in set (0.00 sec)

mysql> select concat('a',QUOTE(NULL));
| concat('a',QUOTE(NULL)) |
| NULL                    |
1 row in set (0.00 sec)
[12 Nov 2004 9:21] Ramil Kalimullin
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