Question

Im trying to convert a legacy bigint field into a sequence of uuids:

DELIMITER | 
CREATE FUNCTION uuid_from_bigint(b bigint) RETURNS CHAR(36) BEGIN
 DECLARE hex CHAR(32);
 SET hex = lpad(hex(b), 32, '0');
 RETURN CONCAT(LEFT(hex, 8), '-', MID(hex, 9,4), '-', MID(hex, 13,4), '-', MID(hex, 17,4), '-', RIGHT(hex, 12));
END
| 
DELIMITER ;

Can someone help me understand why this would cause the following problem?

mysql> select uuid_from_bigint(9);
ERROR 1436 (HY000): Thread stack overrun:  12816 bytes used of a 131072 byte stack, and 128000 bytes needed.  Use 'mysqld --thread_stack=#' to specify a bigger stack.
Was it helpful?

Solution

Turns out there is no problem with this procedure, the problem is with the thread stack configuration.

You can increase the thread_stack size by incrementing it in your my.cnf:

thread_stack = 256K
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top