alamb commented on code in PR #21259:
URL: https://github.com/apache/datafusion/pull/21259#discussion_r3017582234


##########
datafusion/sqllogictest/test_files/select.slt:
##########
@@ -1318,25 +1318,25 @@ statement error
 SELECT * EXCLUDE(a, a)
 FROM table1
 
-# if EXCEPT all the columns, query should still succeed but return empty
-statement ok
+# if EXCEPT all the columns, query should return an error

Review Comment:
   For the record, postgres rejects this syntax
   ```sql
   
   postgres=# CREATE TABLE table1 (
     a int,
     b int,
     c int,
     d int
   ) ;
   CREATE TABLE
   postgres=# SELECT * EXCEPT(a, b, c, d)
   FROM table1;
   ERROR:  syntax error at or near "a"
   LINE 1: SELECT * EXCEPT(a, b, c, d)
                           ^
   ```
   
   Thus I agree we should be following the duckdb behavior
   
   
   ```sql
   memory D CREATE TABLE table1 (
              a int,
              b int,
              c int,
              d int
            );
   ```
   
   However, duckdb  seems to reject this syntax entirely
   
   How did 
   
   ```sql
   memory D SELECT * EXCEPT a, b, c, d FROM table1;
   Parser Error:
   syntax error at or near "a"
   
   LINE 1: SELECT * EXCEPT a, b, c, d FROM table1;
                           ^
   memory D SELECT * EXCEPT(a, b, c, d) FROM table1;
   Parser Error:
   syntax error at or near "a"
   
   LINE 1: SELECT * EXCEPT(a, b, c, d) FROM table1;
                           ^
   ```
   
   
   It looks like the actual syntax is `EXCLUDE` rather than `EXCEPT`...
   
   ```sql
   memory D SELECT * EXCLUDE(a, b, c, d) FROM table1;
   Binder Error:
   SELECT list is empty after resolving * expressions!
   ```
   🤔 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to