1

When starting to write a MySQL query, e.g. describe myt and hitting TAB, MySQL autocomplete will list not just the table names starting with myt (e.g. mytable), but all fields/columns of each matching table. E.g. mytable.id, mytable.name, etc.

This can easily result in Display all 505 possibilities? (y or n), and makes the autocomplete less useful than it could be.

Is there a setting or a trick to let MySQL (or MariaDB) only show the table names, not the field names? Or in other words, to treat the dot in the same way that regular shell/bash autocomplete treats the directory separator?

2

Interesting question! This is one reason I don't use the autocomplete.

It's called auto-rehash if you want to check out the documentation on it.

But, no, looking at the code, I don't believe you can configure this.

  • 1
    Too bad.. maybe it's time for a feature request! – donquixote Feb 17 '16 at 16:53
0

This does not address your question, but it does solve your problem.

I see no reason to start column names with the table name. It clutters queries without providing any benefit. If you are doing JOINs, it is better to qualify the names than to have the names self-qualifying.

  • My column names already do not start with the table name. They never do. And still, MySQL will propose to complete "myt" with "mytable.id", "mytable.color", "mytable.width", etc. – donquixote Feb 17 '16 at 22:51
  • Do you have 505 columns? – Rick James Feb 18 '16 at 0:46
  • There is a database with lots of tables and lots of columns (fyi, it is a Drupal 7 installation). And a lot of tables have the same prefix, e.g. "field_" or "migrate_map_". So when I start with "field_" or "migrate_map_" and then hit tab, I get all columns of all those tables. And worse obviously if I just type one letter. At some point this gave me the number 505. – donquixote Feb 18 '16 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.