Bug #28759 lcase and lower
Submitted: 29 May 2007 22:24 Modified: 13 Nov 2008 15:18
Reporter: Samir Seba Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.12-beta-community, 5.1 BK, 5.0 BK OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: charset, dayname, LOWER, monthname

[29 May 2007 22:24] Samir Seba
Description:
Hi,
I did the following script and it loks like the lower function is not giving the rigth result.
the day was Tuesday
i did the request select  lower(substring(DAYNAME(now()),1,3))
and always a got "Tue"
with "T" ( upper case) not "t".

and also i notice that the "case" function is "case sensitive " and there is no mention about that in the documentation.

Thank you.

How to repeat:
mysql> select  lower(substring(DAYNAME(now()),1,3))
    -> \g
+--------------------------------------+
| lower(substring(DAYNAME(now()),1,3)) |
+--------------------------------------+
| Tue                                  |
+--------------------------------------+
[30 May 2007 8:16] Sveta Smirnova
Thank you for the report.

Verified as described.

But as "select  charset(DAYNAME(now()));" returns binary this can be considered as "Not a Bug". See also bug #24297
[4 Jun 2007 17:41] Timothy Smith
Please check MONTHNAME() as well; I find no mention that the return value is binary, and there is no reason it should be.
[4 Jun 2007 18:07] Sveta Smirnova
But return value is binary:

$mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1179
Server version: 5.1.20-beta-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> 
mysql> select  charset(MONTHNAME(now()));
+---------------------------+
| charset(MONTHNAME(now())) |
+---------------------------+
| binary                    | 
+---------------------------+
1 row in set (0.00 sec)

mysql> \q
Bye
[4 Jun 2007 19:51] Samir Seba
Hi,

sorry, but my request was select lower(substring(DAYNAME(now()),1,3))
not select  charset(DAYNAME(now()))
[3 Sep 2007 20:46] Jon Williams
I've encountered something possibly related, the statement:
CONCAT( 'M', LPAD( 1, 6, '0' ))
Gives M000001, so I would expect LOWER(CONCAT( 'M', LPAD( 1, 6, '0' ))) to return m000001, however it returns M000001.
However, LOWER( CONCAT( 'M', LPAD( CAST( id AS CHAR ) , 6, '0' ) ) ) behaves as expected.
[27 Feb 2008 22:13] 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/commits/43117

ChangeSet@1.2670, 2008-02-28 02:11:18+04:00, gshchepa@host.loc +7 -0
  Fixed bug#28759: The MONTHNAME/DAYNAME functions
  returns binary string, so the LOWER/UPPER functions
  are not effective on the result of MONTHNAME/DAYNAME
  call.
  
  Character set of the MONTHNAME/DAYNAME function
  result has been changed to system charset.