Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/parser.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ join_expr_right
right: read(right),
});
}
/ c1:__ op:(natural_join / cross_join) right:(__ alias$table_factor) {
/ c1:__ op:(natural_join / !sqlite kw:cross_join { return kw; }) right:(__ alias$table_factor) {
return (left: any) => ({
type: "join_expr",
left: trailing(left, c1),
Expand Down Expand Up @@ -834,6 +834,7 @@ partitioned_table

join_op
= &mysql kw:STRAIGHT_JOIN { return kw; }
/ &sqlite kw:cross_join { return kw; }
/ join_type

natural_join
Expand Down
6 changes: 4 additions & 2 deletions test/dml/insert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ describe("insert into", () => {
});

// Issue #124
it("supports ON CONFLICT together with SELECT .. JOIN", () => {
testWc("INSERT INTO tbl SELECT * FROM foo CROSS JOIN bar ON CONFLICT DO NOTHING");
dialect(["postgresql", "plpgsql"], () => {
it("supports ON CONFLICT together with SELECT .. JOIN", () => {
testWc("INSERT INTO tbl SELECT * FROM foo CROSS JOIN bar ON CONFLICT DO NOTHING");
});
});
});
});
Expand Down
5 changes: 5 additions & 0 deletions test/select/join.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ describe("join", () => {
});

dialect("sqlite", () => {
it("supports CROSS JOIN with ON / USING", () => {
testWc("SELECT c FROM t1 CROSS JOIN t2 ON t1.x = t2.x");
testWc("SELECT c FROM t1 CROSS JOIN t2 USING (x)");
});

it("supports NATURAL FULL [OUTER] JOIN", () => {
testWc("SELECT c FROM t1 NATURAL FULL JOIN t2");
testWc("SELECT c FROM t1 NATURAL FULL OUTER JOIN t2");
Expand Down
Loading