Describe the bug
SELECT ... FROM l JOIN r is not a valid SQL query, the ON condition should not be optional
To Reproduce
DataFusion CLI v43.0.0
> SELECT * FROM (SELECT 1 AS id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r;
+----+------+----+------+
| id | name | id | name |
+----+------+----+------+
| 1 | Foo | 1 | Bar |
+----+------+----+------+
1 row(s) fetched.
Expected behavior
The query should be rejected, the ON condition be requiered. In fact, omitting it might be typo with dangerous consequences (expensive cross join).
Trino
trino> SELECT * FROM (SELECT 1 AS id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r;
Query 20241119_124051_00000_rykay failed: line 1:87: mismatched input '<EOF>'. Expecting: 'ON', 'USING'
SELECT * FROM (SELECT 1 AS id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r <EOF>
PostgresSQL
postgres=# SELECT * FROM (SELECT 1 AS id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r;
ERROR: syntax error at or near ";"
LINE 1: ...id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r;
DuckDB
D SELECT * FROM (SELECT 1 AS id, 'Foo' AS name) l JOIN (SELECT 1 AS id, 'Bar' as name) r;
Parser Error: syntax error at or near ";"
LINE 1: ... JOIN (SELECT 1 AS id, 'Bar' as name) r;
^
Additional context
No response
Describe the bug
SELECT ... FROM l JOIN ris not a valid SQL query, theONcondition should not be optionalTo Reproduce
Expected behavior
The query should be rejected, the ON condition be requiered. In fact, omitting it might be typo with dangerous consequences (expensive cross join).
Trino
PostgresSQL
DuckDB
Additional context
No response