Bug #25885 Unable to disable Tab Completion
Submitted: 26 Jan 2007 23:42 Modified: 20 Jul 2011 14:43
Reporter: Stephen Gornick Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.0.37, 5.5.14 OS:Linux (Linux)
Assigned to: CPU Architecture:Any
Tags: client, console, eclipse, editor, paste, SQL, stdin, tab, tab completion, tabs, terminal

[26 Jan 2007 23:42] Stephen Gornick
Description:
I am unable to paste SQL into the mysql command line client on Linux from an editor that uses tabs.  When I do, mysql client thinks I am trying to do tab completion for table and column names and either ignores the tab or attempts to complete the object name.

How to repeat:
Launch an editor that supports tabs (e.g., gedit )

Type in "select now();" but after select use Tabs instead of spaces.
  "select" 
  then press [Tab] 
  then press [Tab] key again
  "now();"

Copy to clipboard:
  Edit -> Select All
  Edit -> Copy 

Launch mysql 
$ mysql -u root -p 

Paste from clipboard:
  Edit -> Paste 

Will show:
  mysql> selectnow();

Press [Enter] key:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selectnow()' at line 1

I can even argue that this can be dangerous in a production environment, for example:

mysql> create schema MySchema;
mysql> create table MySchema.TstTable (col1 int);
mysql> use MySchema;
mysql> drop table Tst[Tab];

Will drop TstTable, even though I never issued that SQL command.

Suggested fix:
Allow a command line option to disable tab completion.  Or else, I suppose you could expand on what the --skip-auto-rehash option does so that it also supresses tab completion.
[22 Mar 2007 19:01] Stephen Gornick
Verified that problem persists in latest 5.0 release.
[20 Jul 2011 13:08] MySQL Verification Team
Actually, 5.1.58 client disables tab completion when you give the -A option.