MySQLdb call procedure with long name

36 views Asked by At

In the documentation for callproc, it uses the procedure name prepended by an underscore and appended with an underscore and the parameter's position. When calling a stored procedure with a long name, this causes a 3061 error User variable name '_extremely_super_duper_long_procedure_name_gets_used_here_0' is illegal. In this specific case, the generated name is 65 characters long (and I believe the maximum length is 64 for user-defined variables.

I'm looking for a workaround to this issue that won't require me to rename all of the stored procedures in my database. I'm working on a one-off project to do a complex data migration, so modifying and retesting a bunch of production stored procedures and all of the applications that call them is not an option.

1

There are 1 answers

0
Bill Karwin On

Sorry, you must rename the procedure. MySQL does not support identifiers longer than 64 characters in most cases. Read https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html

The length limit is hard-coded:

#define NAME_CHAR_LEN 64 /**< Field/table name length */

There is no workaround, unless you are adept with refactoring the source code of MySQL.