findepi commented on issue #13774:
URL: https://github.com/apache/datafusion/issues/13774#issuecomment-2543131831

   > ```
   > > SELECT * FROM server NATURAL JOIN client AS client ORDER BY server.id;
   > Schema error: No field named server.id. Valid fields are client.id, 
client.name, client.stuff.
   > ```
   
   This is actually correct per SQL spec. NATURAL JOIN  is a shorthand for 
USING and when using USING, the join condition columns are deduplicated and 
lose original qualification.
   
   In DataFusion dialect of SQL we probably want to support this though, 
because PostgreSQL supports it
   
   ```
   postgres=# create table client(id int, name varchar, stuff int);
   CREATE TABLE
   postgres=# create table server(id int, name varchar, stuff int);
   CREATE TABLE
   postgres=# SELECT * FROM server NATURAL JOIN client AS client ORDER BY 
server.id;
    id | name | stuff
   ----+------+-------
   (0 rows)
   ```
   
   ... while still deduplicating columns on the output (`id` and other join 
columns appear only once)
   
   


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