|
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.
|