mysqlautocompletecommand-line-interfaceprocedure

In a MySQL CLI, is there a way to autocomplete procedures?


For example, autocomplete allows you to type this:

select cu<TAB> from o<TAB> where nu<TAB> = 42;

And the result can be this:

select customer_name from orders where number = 42;

I would like to be able to do that with created procedures (and functions), which tend to have long names:

call getCustomerByOrderNumber(42);

I cannot find any answers on how to do this. I am using a MySQL CLI on an SSH connection. Running the rehash (or \#) command to rehash the autocompletion list only seems to work for table and column names.


Solution

  • Correct — the rehash feature in the mysql client hashes schemas, tables, and columns, but not other objects (procedures, triggers, functions, events).

    You can confirm this by reading the source for the build_completion_hash() function in mysql.cc.

    Reference: https://github.com/mysql/mysql-server/blob/trunk/client/mysql.cc#L3142-L3250

    Feel free to file a feature request at bugs.mysql.com. Or better yet, implement it yourself and contribute a patch.

    On the other hand, the MySQL developers might turn down the feature request, because they would like new development to focus on MySQL Shell instead of the old mysql client.