Mysql auth and acl causes detect_sql_type_failed error

I’m trying to integrate mysql using mysql procedures and emqx file style configuration. I’m using emqx 5.3.0 and mysql 8.0.

Here’s are the lines of the emqx.conf file that are most relevant:

    query = "call emqx_auth(${username})"

    query = "call emqx_acl(${username})"

I get this error when I run emqx console.

detect_sql_type_failed, mfa: emqx_mysql:parse_batch_prepare_sql/5(422), reason: unknown, sql: <<"call emqx_auth(?)">>

detect_sql_type_failed, mfa: emqx_mysql:parse_batch_prepare_sql/5(422), reason: unknown, sql: <<"call emqx_acl(?)">>

How can I find any information about what detect_sql_type_failed means?

I think this code is responsible for the error:

It doesn’t look like it understands stored procedures, unfortunately. Could you submit a bug report?

Thanks for the detailed answer. I just added a bug report: Mysql auth and acl causes detect_sql_type_failed error · Issue #12028 · emqx/emqx · GitHub

I thought about diving into the code because my system has been using the same procedures for years with emqttd and modifying our system to use select statements means adding tables with redundant data, which can get out of sync, becoming a maintenance issue.

But I got these errors when I tried to build master branch:

cc erlang_jq_nif.o port_nif_common.o  -pthread  -shared -L /src/local/lib/erlang/lib/erl_interface-5.3.2/lib -L ext_libs -lei -ljq -lonig -o ../priv/jq_nif1.so
Undefined symbols for architecture arm64:
  "_enif_alloc", referenced from:
      _load_helper in erlang_jq_nif.o
      _jq_enif_alloc in erlang_jq_nif.o

Just running make again fixed my build problem.

I’ve never coded in erlang until now, but this change seems to work! I can use mysql procedures.

Great stuff! Thanks for that. Please feel free to submit a pull request, we’ll try to review and merge it ASAP. The code looks fine to me, only lacking the autotests, but we can help with that.