mbomb007
mbomb007

Reputation: 4241

How to prevent MariaDB autocomplete mid-query?

I am running a query from the command line, and when I pasted and ran the query, it stopped in the middle to suggest SQL keywords.

My query was something like this:

START TRANSACTION;

UPDATE table_1
SET column_1 = 'value'
WHERE column_2 LIKE '%stuff%'
    AND column_3 IN (
        SELECT column_3
        FROM table_2
    )
;

The result in the terminal:

MariaDB [DB_NAME]> UPDATE table_1
    -> SET column_1 = 'value'
    -> WHERE column_2 LIKE '%stuff%'
    -> AND column_3 IN (
    ->
Display all 5969 possibilities? (y or n)
?
ABS
ACOS
ACTION
ADD
ADDDATE
... (long list)

I think it did this because I ended a line with a parenthesis? Is there a way to prevent this from happening?

Note that I pasted the entire query at once, including the semicolon, so it automatically ran and I did not need any autocomplete.

Upvotes: 0

Views: 164

Answers (1)

Hartmut Holzgraefe
Hartmut Holzgraefe

Reputation: 2765

Make sure that the text you paste does not contain TAB characters, as TAB is the auto-complete key. The command line client can't distinguish between actual keyboard input and pasted text.

Or start the command line client with the "-A" option to disable auto complete, so that TAB becomes a regular whitespace character instead of triggering autocomplete.

Upvotes: 2

Related Questions