findepi opened a new issue, #13486:
URL: https://github.com/apache/datafusion/issues/13486

   ### 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_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to