| Bug #63919 | concat() and concat_ws() may return NULL in not-documented circumstance- | ||
|---|---|---|---|
| Submitted: | 4 Jan 2012 13:02 | Modified: | 6 Jan 2012 15:39 |
| Reporter: | Peter Laursen (Basic Quality Contributor) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Documentation | Severity: | S2 (Serious) |
| Version: | any | OS: | Any |
| Assigned to: | Paul DuBois | CPU Architecture: | Any |
| Tags: | qc | ||
[4 Jan 2012 13:02]
Peter Laursen
[4 Jan 2012 13:22]
Peter Laursen
There is a warning BTW "Warning 1301 Result of concat_ws() was larger than max_allowed_packet (1048576) - truncated"
[4 Jan 2012 13:35]
Peter Laursen
Fixed typo in synopsis
[4 Jan 2012 14:11]
Peter Laursen
let me add that I actually do not return the result concat_ws() as such. I have it wrapped in a checksum calculation (simplified) like md5(concat_ws(p1, p2, .. pn)). I do not see any reason why I should be denied that calculation no matter what max_allowed_packet setting is. I only return 32 bytes to the client!
[4 Jan 2012 16:29]
Valeriy Kravchuk
Thank you for the bug report. Verified with 5.5.20 on Mac OS X:
macbook-pro:5.5 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.5.20-debug Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show session variables like 'max_allowed%';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
1 row in set (0.00 sec)
mysql> select concat('a', repeat('b', 1048576)) as a;
+---+
| a |
+---+
| NULL |
+---+
1 row in set, 1 warning (0.07 sec)
mysql> show warnings\G
*************************** 1. row ***************************
Level: Warning
Code: 1301
Message: Result of concat() was larger than max_allowed_packet (1048576) - truncated
1 row in set (0.00 sec)
So, manual for all versions should include explanations of this case (at least).
[6 Jan 2012 15:39]
Paul DuBois
http://dev.mysql.com/doc/refman/5.5/en/string-functions.html says, following the inital table: " String-valued functions return NULL if the length of the result would be greater than the value of the max_allowed_packet system variable. "
