alamb commented on PR #5132:
URL:
https://github.com/apache/arrow-datafusion/pull/5132#issuecomment-1412180676
Thank you very much @xiaoyong-z -- this is looking great
> There are a few CI tests can not pass, in these tests, there will be order
by columns not in select lists. For these tests, we will add the missing
columns(in order by, but not in select).
> In this pr, we disable the behaviour.
I recommend following the postgres behavior which is to add the missing
columns to the select list *UNLESS* there is a `DISTINCT` clause
Like this:
```sql
postgres=# create table foo as values (1, 'X'), (2, 'Y'), (3, 'Z'), (1, 'Y');
SELECT 4
postgres=# select column1 from foo order by column2;
column1
---------
1
2
1
3
(4 rows)
postgres=# select distinct column1 from foo order by column2;
ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: select distinct column1 from foo order by column2;
postgres=# select distinct column1 from foo;
column1
---------
3
2
1
(3 rows)
```
--
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]