@@ -170,10 +170,12 @@ class Completer {
170170 this . candidates . push ( item )
171171 }
172172
173- addCandidatesForTables ( tables : Table [ ] ) {
174- createTableCandidates ( tables , this . lastToken ) . forEach ( ( item ) => {
175- this . addCandidate ( item )
176- } )
173+ addCandidatesForTables ( tables : Table [ ] , onFromClause : boolean ) {
174+ createTableCandidates ( tables , this . lastToken , onFromClause ) . forEach (
175+ ( item ) => {
176+ this . addCandidate ( item )
177+ }
178+ )
177179 }
178180
179181 addCandidatesForColumnsOfAnyTable ( tables : Table [ ] ) {
@@ -229,7 +231,7 @@ class Completer {
229231 ) || [ ]
230232 this . addCandidatesForExpectedLiterals ( expectedLiteralNodes )
231233 this . addCandidatesForFunctions ( )
232- this . addCandidatesForTables ( this . schema . tables )
234+ this . addCandidatesForTables ( this . schema . tables , false )
233235 }
234236
235237 addCandidatesForSelectQuery ( e : ParseError , fromNodes : FromTableNode [ ] ) {
@@ -244,7 +246,7 @@ class Completer {
244246 this . addCandidatesForFunctions ( )
245247 this . addCandidatesForScopedColumns ( fromNodes , schemaAndSubqueries )
246248 this . addCandidatesForAliases ( fromNodes )
247- this . addCandidatesForTables ( schemaAndSubqueries )
249+ this . addCandidatesForTables ( schemaAndSubqueries , true )
248250 if ( logger . isDebugEnabled ( ) )
249251 logger . debug (
250252 `candidates for error returns: ${ JSON . stringify ( this . candidates ) } `
@@ -267,7 +269,7 @@ class Completer {
267269
268270 addCandidatesForParsedDeleteStatement ( ast : DeleteStatement ) {
269271 if ( isPosInLocation ( ast . table . location , this . pos ) ) {
270- this . addCandidatesForTables ( this . schema . tables )
272+ this . addCandidatesForTables ( this . schema . tables , false )
271273 } else if (
272274 ast . where &&
273275 isPosInLocation ( ast . where . expression . location , this . pos )
@@ -304,7 +306,7 @@ class Completer {
304306 // Column is not scoped to a table/alias yet
305307 // Could be an alias, a talbe or a function
306308 this . addCandidatesForAliases ( fromNodes )
307- this . addCandidatesForTables ( schemaAndSubqueries )
309+ this . addCandidatesForTables ( schemaAndSubqueries , true )
308310 this . addCandidatesForFunctions ( )
309311 }
310312 }
0 commit comments