Bug #101280 Auto complete only works for reserved names. Table names and columns do not
Submitted: 22 Oct 2020 21:35 Modified: 22 Oct 2020 22:18
Reporter: Tiago Link Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:8.0.22 OS:Windows (Windows 10)
Assigned to: CPU Architecture:Any
Tags: auto-complete, auto-completion, columns not auto completing

[22 Oct 2020 21:35] Tiago Link
Description:
Hello.
I checked various places on the web for an answer, but did not find any.
The editor simply does not work for auto completion if you're trying to auto complete table names or column names. I've reinstalled several times to make sure it wasn't the installation. Also, I checked already several times if the options "Enable Code Completion in Editors" and "Automatically Start Code Completion" under Edit > Preferences > SQL Editor > Query Editor. Both options are checked, so I really do not know what is the problem and how to fix it.

I know it is a bug because in versions 6.x this feature just worked as always, and we are in the version 8 but it stills persist.

Will this be solved? Is there a workaround for it? Can something be done so I can use this feature by using Powershell, for example, or Windows CMD? This is really annoying when typing really long queries!

How to repeat:
1. Create a Schema
2. Use the Schema
2. Create a table with some columns
3. Start typing in SQL Editor "SELECT ...", and, in the 3 dots, start typing a column name. It won't suggest an auto complete.

Example of code:

--------------------------------------------------------------

CREATE DATABASE cats;

USE cats;

CREATE TABLE cats
    (
        cat_id INT NOT NULL AUTO_INCREMENT,
        name VARCHAR(100),
        age INT,
        PRIMARY KEY(cat_id)
    );

--------------------------------------------------------------

After this table is created:

1. If I type 'SELECT ca' and wait for the auto completion or press CTRL+Space, these are the suggestions to auto complete:
   a) CASE > a reserved Keyword
   b) CAST > a reserved Keyword
   c) cast() > a Library Function

2. If I type 'SELECT * FROM ca' and wait for the auto completion or press CTRL+Space, these are the suggestions to auto complete:
   a) CASE > a reserved Keyword
   b) CAST > a reserved Keyword
   c) cast() > a Library Function

Suggested fix:
By following both examples in the 'How to repeat' section (1 and 2), not only CASE, CAST and cast() should be suggested by the editor, but also:

- 'cats', which is a table name;
- 'cat_id', which is a column name.

Please, make it work like the versions 6.x, in which this feature of auto completing table names and column names were working perfectly. I do not want to Downgrade, it is UNACCEPTABLE that we do not have this feature in the newest version.
[22 Oct 2020 22:15] MySQL Verification Team
Works

Attachment: 101280_1.png (image/png, text), 87.13 KiB.

[22 Oct 2020 22:16] MySQL Verification Team
Wrks

Attachment: 101280_2.png (image/png, text), 68.40 KiB.

[22 Oct 2020 22:18] MySQL Verification Team
Thank you for the bug report. Please see screenshots.
[23 Oct 2020 2:13] Brian Plunkett
AutoCompletion Error from "Sele..." not completing keyword "SELECT"

Attachment: AutoCompletionError.png (image/png, text), 2.55 KiB.

[23 Oct 2020 2:31] Brian Plunkett
MySQL Community:

Tiago Link is correct in that there are intermittent caching issues with the member list for the autocompletion code.  This is happening for multiple reasons, the primary being that once the AutoCompletion code encounters an error in the SQLEditor pane while the "Automatically Start Code Completion" setting is enabled, the code continues to have completion errors.  This might be due to a race condition within the user interface and/or window management system.

One thing I've determined, the completion code fails less if/when the table has been added to the statement before trying to process for column names.  An example would be "SELECT * FROM table" then, going back and editing the wildcard.  Whether a default database was selected or not, the problem presents itself the same way.  I've consistently had the error while trying to type simply "SELECT * FROM information_schema.COLUMNS".

Suggested workaround:

Use the Snippets to populate most of the statement(s) into the SQLEditor, and then edit the specific areas of the statement to reduce any errors which might be occurring from an event firing (and possibly failing) on each character typed.  You'll be happier if you type less!