I have a case where I must know if group_concat_max_len is at its default value (1024), which means there are some operation I cannot work out. I’ve ranted on this here.
Normally, I would simply:
SELECT @@group_concat_max_len
However, I am using views, where session variables are not allowed. Using a stored function can do the trick, but I wanted to avoid stored routines. So here’s a very simple test case: is the current group_concat_max_len long enough or not? I’ll present the long version and the short version.
The long version
SELECT CHAR_LENGTH( GROUP_CONCAT( COLLATION_NAME SEPARATOR '' ) ) FROM INFORMATION_SCHEMA.COLLATIONS;
If the result is 1024, we are in a bad shape. I happen to know that the total length of collation names is above 1800, and so it is trimmed down. Another variance of the above query would be: Continue reading » “Verifying GROUP_CONCAT limit without using variables”