mirror of https://github.com/AMT-Cheif/drift.git
Fix not resolved columns bug
This commit is contained in:
parent
a9fd12e565
commit
7129468928
|
@ -47,6 +47,8 @@ class TypeResolver extends RecursiveVisitor<TypeExpectation, void> {
|
|||
currentColumnIndex++;
|
||||
} else if (child is StarResultColumn) {
|
||||
currentColumnIndex += child.scope.availableColumns.length;
|
||||
} else if (child is NestedQueryColumn) {
|
||||
visit(child.select, arg);
|
||||
}
|
||||
} else {
|
||||
visit(child, arg);
|
||||
|
|
|
@ -112,6 +112,25 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
test('resolves columns in nested queries', () {
|
||||
final engine = SqlEngine(EngineOptions(useMoorExtensions: true))
|
||||
..registerTable(demoTable);
|
||||
|
||||
final context =
|
||||
engine.analyze('SELECT content, LIST(SELECT id FROM demo) FROM demo');
|
||||
|
||||
expect(context.errors, isEmpty);
|
||||
|
||||
final select = context.root as SelectStatement;
|
||||
final nestedQuery = select.columns[1] as NestedQueryColumn;
|
||||
|
||||
expect(nestedQuery.select.columns, hasLength(1));
|
||||
expect(
|
||||
context.typeOf(nestedQuery.select.resolvedColumns!.single).type!.type,
|
||||
BasicType.int,
|
||||
);
|
||||
});
|
||||
|
||||
group('reports correct column name for rowid aliases', () {
|
||||
final engine = SqlEngine()
|
||||
..registerTable(demoTable)
|
||||
|
|
Loading…
Reference in New Issue