|
@@ -40,6 +40,7 @@
|
|
|
beforeCursor: 'SELECT * FROM testTable1 JOIN db1.table2; ',
|
|
beforeCursor: 'SELECT * FROM testTable1 JOIN db1.table2; ',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 41 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 41 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line:1, last_line:1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable1' }] }, { identifierChain: [{ name: 'db1' }, { name: 'table2' }] }] },
|
|
{ type: 'asterisk', location: { first_line:1, last_line:1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable1' }] }, { identifierChain: [{ name: 'db1' }, { name: 'table2' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable1' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable1' }] },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 34}, identifierChain: [{ name: 'db1' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 34}, identifierChain: [{ name: 'db1' }]},
|
|
@@ -56,6 +57,7 @@
|
|
|
beforeCursor: 'SELECT db.tbl.col FROM db.tbl; ',
|
|
beforeCursor: 'SELECT db.tbl.col FROM db.tbl; ',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 30 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 30 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 18 } },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'db' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'db' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'db' }, { name: 'tbl' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'col'}], tables: [{ identifierChain: [{ name: 'db' }, { name: 'tbl' }]}]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'col'}], tables: [{ identifierChain: [{ name: 'db' }, { name: 'tbl' }]}]},
|
|
@@ -72,6 +74,7 @@
|
|
|
beforeCursor: 'select x from x;',
|
|
beforeCursor: 'select x from x;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
@@ -85,11 +88,13 @@
|
|
|
beforeCursor: 'select x from x;select y from y;',
|
|
beforeCursor: 'select x from x;select y from y;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 16 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 32 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 32 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 24, last_column: 25 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 25 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 25 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 32 }, identifierChain: [{ name: 'y' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 32 }, identifierChain: [{ name: 'y' }] },
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
@@ -103,11 +108,13 @@
|
|
|
beforeCursor: '-- comment\nselect x from x;\n\n\nselect y from y;',
|
|
beforeCursor: '-- comment\nselect x from x;\n\n\nselect y from y;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 2, last_line: 2, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }] },
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }] },
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'statement', location: { first_line: 2, last_line: 5, first_column: 17, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 2, last_line: 5, first_column: 17, last_column: 16 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 5, last_line: 5, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
{ type: 'column', location: { first_line: 5, last_line: 5, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'y' }], tables: [{ identifierChain: [{ name: 'y' }] }] },
|
|
|
{ type: 'table', location: { first_line: 5, last_line: 5, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'y' }] },
|
|
{ type: 'table', location: { first_line: 5, last_line: 5, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'y' }] },
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 5, last_line: 5, first_column: 16, last_column: 16 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 5, last_line: 5, first_column: 16, last_column: 16 }},
|
|
@@ -121,6 +128,7 @@
|
|
|
beforeCursor: 'select x from x, y;',
|
|
beforeCursor: 'select x from x, y;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 19 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 19 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }, { identifierChain: [{ name: 'y' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, identifierChain: [{ name: 'x' }], tables: [{ identifierChain: [{ name: 'x' }] }, { identifierChain: [{ name: 'y' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 16 }, identifierChain: [{ name: 'x' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 19 }, identifierChain: [{ name: 'y' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 19 }, identifierChain: [{ name: 'y' }]},
|
|
@@ -135,9 +143,10 @@
|
|
|
beforeCursor: 'SELECT t3.id, id FROM testTable1, db.testTable2, testTable3 t3;',
|
|
beforeCursor: 'SELECT t3.id, id FROM testTable1, db.testTable2, testTable3 t3;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 63 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 63 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 17 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable3' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable3' }] },
|
|
|
- { type:'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 13 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'testTable3' }], alias: 't3' }] },
|
|
|
|
|
- { type:'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 17 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'testTable1' }]}, { identifierChain: [{ name: 'db' }, { name: 'testTable2' }]}, { identifierChain: [{ name: 'testTable3' }], alias: 't3'}] },
|
|
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 13 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'testTable3' }], alias: 't3' }] },
|
|
|
|
|
+ { type: 'column', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 17 }, identifierChain: [{ name: 'id' }], tables: [{ identifierChain: [{ name: 'testTable1' }]}, { identifierChain: [{ name: 'db' }, { name: 'testTable2' }]}, { identifierChain: [{ name: 'testTable3' }], alias: 't3'}] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33 }, identifierChain: [{ name: 'testTable1' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33 }, identifierChain: [{ name: 'testTable1' }] },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 37 }, identifierChain: [{ name: 'db' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 35, last_column: 37 }, identifierChain: [{ name: 'db' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 38, last_column: 48 }, identifierChain: [{ name: 'db' },{ name: 'testTable2'}] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 38, last_column: 48 }, identifierChain: [{ name: 'db' },{ name: 'testTable2'}] },
|
|
@@ -154,6 +163,7 @@
|
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (1+1, 2+2);',
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (1+1, 2+2);',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 42 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 42 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 42 } },
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 42 } },
|
|
@@ -168,6 +178,7 @@
|
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (id+1-1, id+1-2);',
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (id+1-1, id+1-2);',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 48 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 48 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 48 }},
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 48 }},
|
|
@@ -200,6 +211,7 @@
|
|
|
'LIMIT 1000;',
|
|
'LIMIT 1000;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 9, first_column: 1, last_column: 11 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 9, first_column: 1, last_column: 11 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 2, first_column: 8, last_column: 26 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'sample_07' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'sample_07' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 23 }, identifierChain: [{ name: 'description' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 23 }, identifierChain: [{ name: 'description' }], tables: [{ identifierChain: [{ name: 'sample_07' }], alias: 's07' }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain: [{ name: 'sample_07' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain: [{ name: 'sample_07' }] },
|
|
@@ -238,8 +250,10 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 59 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 59 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'bl' }], tables: [{ identifierChain: [{ name: 'blablabla' }] }, { subQuery: 's1' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'bl' }], tables: [{ identifierChain: [{ name: 'blablabla' }] }, { subQuery: 's1' }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 25 }, identifierChain: [{ name: 'blablabla' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 25 }, identifierChain: [{ name: 'blablabla' }] },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 39, last_column: 40 }, subquery: true },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 39, last_column: 40 }, tables: [{ identifierChain: [{ name: 'blablabla' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 39, last_column: 40 }, tables: [{ identifierChain: [{ name: 'blablabla' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 46, last_column: 55 }, identifierChain: [{ name: 'blablabla' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 46, last_column: 55 }, identifierChain: [{ name: 'blablabla' }] },
|
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 1, last_line: 1, first_column: 55, last_column: 55 }},
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 1, last_line: 1, first_column: 55, last_column: 55 }},
|
|
@@ -260,6 +274,7 @@
|
|
|
beforeCursor: 'SELECT CASE cos(boo.a) > baa.boo \n\tWHEN baa.b THEN true \n\tWHEN boo.c THEN false \n\tWHEN baa.blue THEN boo.d \n\tELSE baa.e END \n\t FROM db1.foo boo, bar baa WHERE baa.bla IN (SELECT ble FROM bla);',
|
|
beforeCursor: 'SELECT CASE cos(boo.a) > baa.boo \n\tWHEN baa.b THEN true \n\tWHEN boo.c THEN false \n\tWHEN baa.blue THEN boo.d \n\tELSE baa.e END \n\t FROM db1.foo boo, bar baa WHERE baa.bla IN (SELECT ble FROM bla);',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 6, first_column: 1, last_column: 67 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 6, first_column: 1, last_column: 67 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 5, first_column: 8, last_column: 16 } },
|
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 13, last_column: 15 }, function: 'cos'},
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 13, last_column: 15 }, function: 'cos'},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'db1' },{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'db1' },{ name: 'foo' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 22 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'db1' }, { name: 'foo' }], alias: 'boo' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 22 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'db1' }, { name: 'foo' }], alias: 'boo' }]},
|
|
@@ -283,6 +298,7 @@
|
|
|
{ type: 'whereClause', missing: false, location: { first_line: 6, last_line: 6, first_column: 29, last_column: 67 } },
|
|
{ type: 'whereClause', missing: false, location: { first_line: 6, last_line: 6, first_column: 29, last_column: 67 } },
|
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 35, last_column: 38 }, identifierChain: [{ name: 'bar' }]},
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 35, last_column: 38 }, identifierChain: [{ name: 'bar' }]},
|
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 39, last_column: 42 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'bar' }], alias: 'baa' }] },
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 39, last_column: 42 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'bar' }], alias: 'baa' }] },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 6, last_line: 6, first_column: 54, last_column: 57 }, subquery: true },
|
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 54, last_column: 57 }, identifierChain: [{ name: 'ble' }], tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
{ type: 'column', location: { first_line: 6, last_line: 6, first_column: 54, last_column: 57 }, identifierChain: [{ name: 'ble' }], tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 63, last_column: 66 }, identifierChain: [{ name: 'bla' }]},
|
|
{ type: 'table', location: { first_line: 6, last_line: 6, first_column: 63, last_column: 66 }, identifierChain: [{ name: 'bla' }]},
|
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 6, last_line: 6, first_column: 66, last_column: 66 } },
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 6, last_line: 6, first_column: 66, last_column: 66 } },
|
|
@@ -297,6 +313,7 @@
|
|
|
beforeCursor: 'SELECT tta.* FROM testTableA tta, testTableB; ',
|
|
beforeCursor: 'SELECT tta.* FROM testTableA tta, testTableB; ',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 45 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 45 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 13 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'asterisk', location:{ first_line: 1, last_line: 1, first_column: 12, last_column: 13 }, tables: [{ alias: 'tta', identifierChain: [{ name: 'testTableA' }] }] },
|
|
{ type: 'asterisk', location:{ first_line: 1, last_line: 1, first_column: 12, last_column: 13 }, tables: [{ alias: 'tta', identifierChain: [{ name: 'testTableA' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 29}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 29}, identifierChain: [{ name: 'testTableA' }]},
|
|
@@ -313,6 +330,7 @@
|
|
|
beforeCursor: 'SELECT COUNT(*) FROM testTable;',
|
|
beforeCursor: 'SELECT COUNT(*) FROM testTable;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 31 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 31 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 } },
|
|
|
{ type: 'function', location:{ first_line: 1, last_line: 1, first_column: 8, last_column: 12}, function: 'count'},
|
|
{ type: 'function', location:{ first_line: 1, last_line: 1, first_column: 8, last_column: 12}, function: 'count'},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 31}, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 31}, identifierChain: [{ name: 'testTable' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 31, last_column: 31 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 31, last_column: 31 }},
|
|
@@ -353,6 +371,7 @@
|
|
|
beforeCursor: 'SELECT * FROM testTable t1 ORDER BY t1.a ASC, t1.b, t1.c DESC, t1.d;\nSELECT t1.bla FROM testTable2 t1;\nSELECT * FROM testTable3 t3, testTable4 t4; ',
|
|
beforeCursor: 'SELECT * FROM testTable t1 ORDER BY t1.a ASC, t1.b, t1.c DESC, t1.d;\nSELECT t1.bla FROM testTable2 t1;\nSELECT * FROM testTable3 t3, testTable4 t4; ',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 68 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 68 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ alias: 't1', identifierChain: [{ name: 'testTable' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ alias: 't1', identifierChain: [{ name: 'testTable' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
{ type: 'alias', source: 'table', alias: 't1', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 27 }, identifierChain: [{ name: 'testTable' }] },
|
|
{ type: 'alias', source: 'table', alias: 't1', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 27 }, identifierChain: [{ name: 'testTable' }] },
|
|
@@ -367,6 +386,7 @@
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 67, last_column: 68 }, identifierChain: [{ name: 'd' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 67, last_column: 68 }, identifierChain: [{ name: 'd' }], tables: [{ identifierChain: [{ name: 'testTable' }], alias: 't1' }]},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 68, last_column: 68 }},
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 68, last_column: 68 }},
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 69, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 69, last_column: 33 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 2, last_line: 2, first_column: 8, last_column: 14 } },
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable2' }]},
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'testTable2' }]},
|
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTable2' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 2, last_line: 2, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'bla' }], tables: [{ identifierChain: [{ name: 'testTable2' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 20, last_column: 30 }, identifierChain: [{ name: 'testTable2' }]},
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 20, last_column: 30 }, identifierChain: [{ name: 'testTable2' }]},
|
|
@@ -374,6 +394,7 @@
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 33, last_column: 33 }},
|
|
|
{ type: 'statement', location: { first_line: 2, last_line: 3, first_column: 34, last_column: 43 } },
|
|
{ type: 'statement', location: { first_line: 2, last_line: 3, first_column: 34, last_column: 43 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 3, last_line: 3, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 3, last_line: 3, first_column: 8, last_column: 9 }, tables: [{ alias: 't3', identifierChain: [{ name: 'testTable3' }]}, { alias: 't4', identifierChain: [{ name: 'testTable4' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 3, last_line: 3, first_column: 8, last_column: 9 }, tables: [{ alias: 't3', identifierChain: [{ name: 'testTable3' }]}, { alias: 't4', identifierChain: [{ name: 'testTable4' }] }] },
|
|
|
{ type: 'table', location: { first_line: 3, last_line: 3, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable3' }]},
|
|
{ type: 'table', location: { first_line: 3, last_line: 3, first_column: 15, last_column: 25 }, identifierChain: [{ name: 'testTable3' }]},
|
|
|
{ type: 'alias', source: 'table', alias: 't3', location: { first_line: 3, last_line: 3, first_column: 26, last_column: 28 }, identifierChain: [{ name: 'testTable3' }] },
|
|
{ type: 'alias', source: 'table', alias: 't3', location: { first_line: 3, last_line: 3, first_column: 26, last_column: 28 }, identifierChain: [{ name: 'testTable3' }] },
|
|
@@ -391,6 +412,7 @@
|
|
|
beforeCursor: 'SELECT t1.foo FROM table1 t1 CROSS JOIN table2 LEFT OUTER JOIN table3 JOIN table4 t4 ON (t1.c1 = table2.c2); ',
|
|
beforeCursor: 'SELECT t1.foo FROM table1 t1 CROSS JOIN table2 LEFT OUTER JOIN table3 JOIN table4 t4 ON (t1.c1 = table2.c2); ',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 108 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 108 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 14 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'table1' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 10 }, identifierChain: [{ name: 'table1' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'table1' }], alias: 't1' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14 }, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'table1' }], alias: 't1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 20, last_column: 26 }, identifierChain: [{ name: 'table1' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 20, last_column: 26 }, identifierChain: [{ name: 'table1' }]},
|
|
@@ -415,10 +437,12 @@
|
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (SELECT * FROM bla);',
|
|
beforeCursor: 'SELECT * FROM foo WHERE bar IN (SELECT * FROM bla);',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 51 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 51 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'foo' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 18 }, identifierChain: [{ name: 'foo' }]},
|
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 51 }},
|
|
{ type: 'whereClause', missing: false, location: { first_line: 1, last_line: 1, first_column: 19, last_column: 51 }},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 25, last_column: 28 }, identifierChain:[{ name: 'bar'}], tables: [{ identifierChain: [{ name: 'foo' }] }]},
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, subquery: true },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 40, last_column: 41 }, tables: [{ identifierChain: [{ name: 'bla' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 50 }, identifierChain: [{ name: 'bla' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 47, last_column: 50 }, identifierChain: [{ name: 'bla' }]},
|
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 1, last_line: 1, first_column: 50, last_column: 50 }},
|
|
{ type: 'whereClause', subquery: true, missing: true, location: { first_line: 1, last_line: 1, first_column: 50, last_column: 50 }},
|
|
@@ -435,6 +459,7 @@
|
|
|
afterCursor: ' FROM testTableA',
|
|
afterCursor: ' FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 32 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 32 } },
|
|
|
|
|
+ { type: 'selectList', missing: true, location: { first_line: 1, last_line: 1, first_column: 7, last_column: 7 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 32}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 32}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }}
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 32, last_column: 32 }}
|
|
@@ -449,6 +474,7 @@
|
|
|
afterCursor: ' FROM testTableA',
|
|
afterCursor: ' FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 34 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 34 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 10, last_column: 13 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 10, last_column: 11 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 10, last_column: 11 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 34}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 24, last_column: 34}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 34, last_column: 34 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 34, last_column: 34 }},
|
|
@@ -464,6 +490,7 @@
|
|
|
afterCursor: ' FROM testTableA',
|
|
afterCursor: ' FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 27 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 27 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 27}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 27}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }}
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 27, last_column: 27 }}
|
|
@@ -478,6 +505,7 @@
|
|
|
afterCursor: ' \nFROM testTableA',
|
|
afterCursor: ' \nFROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 2, first_column: 1, last_column: 16 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 } },
|
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 6, last_column: 16}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 2, last_line: 2, first_column: 6, last_column: 16}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }}
|
|
{ type: 'limitClause', missing: true, location: { first_line: 2, last_line: 2, first_column: 16, last_column: 16 }}
|
|
@@ -492,6 +520,7 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 28 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 28 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 12 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 28}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 18, last_column: 28}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }}
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 28, last_column: 28 }}
|
|
@@ -506,6 +535,7 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 17 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 23, last_column: 33}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }},
|
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }}
|
|
{ type: 'limitClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 33, last_column: 33 }}
|
|
@@ -520,6 +550,7 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 37 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 37 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 13 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 37}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 27, last_column: 37}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 37, last_column: 37 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 37, last_column: 37 }},
|
|
@@ -535,6 +566,7 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 40 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 40 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9}, identifierChain: [{ name: 'b' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9}, identifierChain: [{ name: 'b' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 11, last_column: 14}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 30, last_column: 40}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 30, last_column: 40}, identifierChain: [{ name: 'testTableA' }]},
|
|
@@ -551,6 +583,7 @@
|
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
afterCursor: 'bbbb FROM testTableA',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 15 } },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11}, identifierChain: [{ name: 'foo' }], tables: [{ identifierChain: [{ name: 'testTableA' }] }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 28, last_column: 38}, identifierChain: [{ name: 'testTableA' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 28, last_column: 38}, identifierChain: [{ name: 'testTableA' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 38, last_column: 38 }},
|
|
@@ -566,6 +599,7 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 33 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 15 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 29 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 29 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
@@ -583,6 +617,7 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 38 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 20 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 15 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }], alias: 'tbl' }] },
|
|
@@ -601,6 +636,7 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 39 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 39 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 25 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 16 }, identifierChain: [{ name: 'some_tbl' }] },
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 17, last_column: 20 }, identifierChain: [{ name: 'col' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
{ type: 'complex', location: { first_line: 1, last_line: 1, first_column: 21, last_column: 25 }, identifierChain: [{ name: 'col' }, { name: 'cplx' }], tables: [{ identifierChain: [{ name: 'some_tbl' }] }] },
|
|
@@ -619,6 +655,7 @@
|
|
|
afterCursor: 'hijk, tta.bla, cos(1) FROM testTableA tta, testTableB;',
|
|
afterCursor: 'hijk, tta.bla, cos(1) FROM testTableA tta, testTableB;',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 94 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 94 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 52 } },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 18 }, identifierChain: [{ name: 'testTableB' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 18 }, identifierChain: [{ name: 'testTableB' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 20 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableB' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 19, last_column: 20 }, identifierChain: [{ name: 'a' }], tables: [{ identifierChain: [{ name: 'testTableB' }] }]},
|
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 24 }, function: 'cos' },
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 24 }, function: 'cos' },
|
|
@@ -644,11 +681,13 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 271 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 271 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 36 } },
|
|
|
{ type: 'subQuery', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ subQuery: 'tmp' }]},
|
|
{ type: 'subQuery', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 11 }, identifierChain: [{ subQuery: 'tmp' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 14 }, identifierChain: [{ name: 'bc' }], tables: [{ subQuery: 'tmp' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 12, last_column: 14 }, identifierChain: [{ name: 'bc' }], tables: [{ subQuery: 'tmp' }]},
|
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, function: 'round' },
|
|
{ type: 'function', location: { first_line: 1, last_line: 1, first_column: 16, last_column: 20 }, function: 'round' },
|
|
|
{ type: 'subQuery', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 25 }, identifierChain: [{ subQuery: 'tmp' }]},
|
|
{ type: 'subQuery', location: { first_line: 1, last_line: 1, first_column: 22, last_column: 25 }, identifierChain: [{ subQuery: 'tmp' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 26, last_column: 27 }, identifierChain: [{ name: 'r' }], tables: [{ subQuery: 'tmp' }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 26, last_column: 27 }, identifierChain: [{ name: 'r' }], tables: [{ subQuery: 'tmp' }]},
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 51, last_column: 108 }, subquery: true },
|
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 51, last_column: 57 }, identifierChain: [{ name: 'tstDb1' }]},
|
|
{ type: 'database', location: { first_line: 1, last_line: 1, first_column: 51, last_column: 57 }, identifierChain: [{ name: 'tstDb1' }]},
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 58, last_column: 60 }, identifierChain: [{ name:'tstDb1' }, { name: 'b1' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 58, last_column: 60 }, identifierChain: [{ name:'tstDb1' }, { name: 'b1' }]},
|
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 61, last_column: 64 }, identifierChain: [{ name: 'cat' }], tables: [{ identifierChain: [{ name:'tstDb1' }, {name: 'b1' }] }]},
|
|
{ type: 'column', location: { first_line: 1, last_line: 1, first_column: 61, last_column: 64 }, identifierChain: [{ name: 'cat' }], tables: [{ identifierChain: [{ name:'tstDb1' }, {name: 'b1' }] }]},
|
|
@@ -689,6 +728,7 @@
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
expectedLocations: [
|
|
expectedLocations: [
|
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 53 } },
|
|
{ type: 'statement', location: { first_line: 1, last_line: 1, first_column: 1, last_column: 53 } },
|
|
|
|
|
+ { type: 'selectList', missing: false, location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 } },
|
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable' }] }] },
|
|
{ type: 'asterisk', location: { first_line: 1, last_line: 1, first_column: 8, last_column: 9 }, tables: [{ identifierChain: [{ name: 'testTable' }] }] },
|
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
{ type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 24 }, identifierChain: [{ name: 'testTable' }]},
|
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 24, last_column: 24 }},
|
|
{ type: 'whereClause', missing: true, location: { first_line: 1, last_line: 1, first_column: 24, last_column: 24 }},
|