Skip to content

Commit e1849a7

Browse files
committed
test: query as column might be null
1 parent 4252023 commit e1849a7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/inferQueryResult.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,15 @@ it("should detect when a not null column is always present", () => {
187187
{ name: "id", type: ColumnType.Number },
188188
]);
189189
});
190+
191+
it("should support query as column", () => {
192+
const result = testInferQueryResult(
193+
"CREATE TABLE foo (id text not null)",
194+
"SELECT (SELECT id FROM foo) AS id",
195+
);
196+
197+
// If table foo is empty then id will be null
198+
expect(result).toStrictEqual<typeof result>([
199+
{ name: "id", type: ColumnType.String | ColumnType.Null },
200+
]);
201+
});

0 commit comments

Comments
 (0)