Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Not a Bug
-
Affects Version/s: 10.0.10
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
replace into mysql.http_contents select '/history', (select CONCAT('{"server":"zOBFqxNABETgELkfy0nYH8G+Olk=","history":[', GROUP_CONCAT(COLUMN_JSON(status) separator ',\n') ,'\n]}') from mysql.http_status_history ORDER BY COLUMN_GET(status,'date' as datetime) ), 'text/plain';
MariaDB [(none)]> show warnings;
+---------+------+-----------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------------------+
| Warning | 1301 | Result of concat() was larger than max_allowed_packet (1048576) - truncated |
+---------+------+-----------------------------------------------------------------------------+
1 row in set (0.00 sec)
select * from mysql.http_contents where name="/history";
+----------+---------+------------+
| name | content | type |
+----------+---------+------------+
| /history | NULL | text/plain |
+----------+---------+------------+
1 row in set (0.02 sec)
MariaDB [(none)]> select CONCAT('{"server":"zOBFqxNABETgELkfy0nYH8G+Olk=","history":[', GROUP_CONCAT(COLUMN_JSON(status) separator ',\n') ,'\n]}') from from mysql.http_status_history ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from mysql.http_status_history' at line 1
MariaDB [(none)]> select CONCAT('{"server":"zOBFqxNABETgELkfy0nYH8G+Olk=","history":[', GROUP_CONCAT(COLUMN_JSON(status) separator ',\n') ,'\n]}') from mysql.http_status_history ;
+----------------------------------------------------------------------------------------------------------------------------+
| CONCAT('{"server":"zOBFqxNABETgELkfy0nYH8G+Olk=","history":[', GROUP_CONCAT(COLUMN_JSON(status) separator ',\n') ,'\n]}') |
+----------------------------------------------------------------------------------------------------------------------------+
| NULL |
+----------------------------------------------------------------------------------------------------------------------------+
1 row in set, 1 warning (0.02 sec)
This code works fine when max_allowed_packed is increased
Possible issue are :
- max_allowed_packed is not a session variable and can't be easily changed dynamically
- should truncate the result but not return NULL on overflow
- max_allowed_packed is documented to be the query buffer and not the query result buffer.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
That's how it works in all versions of MySQL (at least starting from 5.1), and MariaDB.
NULL for string functions is explicitly documented in MySQL manual ( http://dev.mysql.com/doc/refman/5.5/en/string-functions.html ):
Regarding this:
Could you please point at the place in documentation where it is said? It might need fixing.
The main max_allowed_packet description, both in MySQL manual and in MariaDB KB, says nothing of the kind:
http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_max_allowed_packet
https://mariadb.com/kb/en/server-system-variables/#max_allowed_packet
Given the above, I'm closing it as not a bug. If you disagree, please comment to re-open.