Disabling database schema/table names being prepended with autocomplete

Answered

Hello,

Something that's been driving me nuts recently, after finally upgrading to 2016.2 (I'm reasonably sure this wasn't the case in previous IDEA versions): whenever I use autocomplete in SQL queries (either in the console window, SQL files or my DAO classes), IDEA fully qualifies table/column names with database schema/table names.Basically, it turns something like 

select * from TOPICS where tp_id = 1

into

select * from `bluesky-dev`.TOPICS where `bluesky-dev`.TOPICS.tp_id = 1

rendering autocomplete, essentially, unusable. Any idea how to turn this "feature" off?

6
16 comments

Please check that you have current schema set to needed schema in Database Console editor's tool bar or you have needed schemas checked in Options tab in Data Source properties dialog to be resolved unqualified.

2

I'm having the same problem in 2017.1.2. IntelliJ doesn't add the schema name in the database console, but it does when writing PHP code. I don't see anything in the data source properties that looks like "resolved unqualified." Did that change in 2017 versions? How can I prevent the schema name from being prepended to table names?

0
Avatar
Vitaliy Bedokur

Is there still any way to fix it? There is nothing at all regarding 'unqualified' in the whole settings.

1

It's buried in the settings in a place you would probably never look: Editor > General > Smart Keys. Scroll down to the SQL section. You'll find the option to turn it off there. 

44

Oh. My. God. Thank you, thank you, thank you Sean! Works exactly as I would've expected.

1

This has been bugging the hell out of me. Thanks for the help, Sean!

0

Thank you, Sean. This was drivinig me crazy!

0

Thank you, Sean! Really appreciated.

0

Even that does not prohibit the schema name from being prepended, when exporting the result of a query as insert statements.

As such inserts often are produced to be able to run the resulting inserts in another schema/database, it eludes me why IJ insists on prepending the table names with the current schema name, and makes it very hard, not to say impossible, to change that behaviour.

IntelliJ 2020.2.

0

IntelliJ IDEA 2022.2 appears to only have two options in the Editor -> General -> Smart Keys -> SQL settings: "Insert string concatenation on Enter" and "Close code blocks on Enter". Turning both of those off didn't relieve the pain of having the full database table name path inserting on autocompletion when I really just want the table's name itself. 

The above post says "You'll find the option to turn it off there". Which option specifically was it that worked?

Thanks!

1

Ahaws, Preferences/Settings | Editor | General | Code Completion | SQL | Qualify object with | Table | Never.

15

That's it! Thank You!

0

Thank you thank you!   This was driving me absolutely bonkers!

0

Thanks @..., Daniil you guys saved me!

0

Please sign in to leave a comment.