MySQL raises error 3217 when audit_log_filter_read() receives a max_array_length argument that is not an unsigned integer.
MySQL error ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE (3217) appears when the max_array_length parameter passed to audit_log_filter_read() is not an unsigned integer. Supply a valid UNSIGNED integer or NULL to resolve the problem.
ER_AUDIT_LOG_UDF_READ_INVALID_MAX_ARRAY_LENGTH_ARG_TYPE
MySQL raises error 3217 when the audit_log_filter_read() UDF receives a max_array_length argument whose data type is not an unsigned integer. The server stops the call to prevent incorrect parsing of the JSON audit log array.
The error was introduced in MySQL 5.7.22 with the audit log UDFs. Applications that query audit logs hit this error immediately after sending a string, signed integer, float or improperly cast NULL.
The primary trigger is supplying a non-integer or negative value to the max_array_length parameter while calling audit_log_filter_read().
Other triggers include dynamic SQL that concatenates user input without validation, stored procedures that cast the argument to the wrong type, and drivers that bind the parameter as VARCHAR instead of BIGINT UNSIGNED.
Validate the argument in application code and ensure it is an unsigned integer literal or BIGINT UNSIGNED variable before calling the UDF.
If you need the entire array, pass NULL explicitly after confirming that your MySQL version accepts NULL for unlimited size.
When reading large audit logs from a scripting language, cast numeric CLI arguments to INTEGER before building the SQL.
In stored procedures, declare the variable as BIGINT UNSIGNED and CAST input values accordingly to guarantee the right type.
Always parameterize SQL and bind the value as an unsigned integer in your driver.
Add CHECK constraints or BEFORE triggers to verify positive integers before calling wrapper procedures.
Error 3216 ER_AUDIT_LOG_UDF_READ_INVALID_BUFFER_SIZE_ARG_TYPE arises when buffer_size is of the wrong type; fix by passing UNSIGNED.
Error 3218 ER_AUDIT_LOG_UDF_READ_INVALID_READ_SIZE_ARG_TYPE appears for an invalid read_size argument; resolve with a correct UNSIGNED value.
The argument is supplied as VARCHAR, FLOAT or DECIMAL instead of an integer.
A negative or signed value is passed, violating the unsigned requirement.
A NULL is provided on a server version that does not accept NULL for unlimited length.
The language driver binds the variable as a string by default.
Raised when buffer_size argument type is invalid.
Occurs when read_size argument type is not an unsigned integer.
Thrown when a string argument to the audit log UDF is invalid.
You can revoke EXECUTE privileges on the UDFs or uninstall the audit_log plugin, but you will lose audit log querying capabilities.
Upgrading does not change type requirements; you still must supply an unsigned integer.
Starting with MySQL 8.0.0, NULL is accepted for unlimited size, but verify with SELECT VERSION() first.
Galaxy highlights parameter types in the SQL editor and displays linting hints, reducing the chance of passing the wrong data type.