xuzifu666 commented on code in PR #4933:
URL: https://github.com/apache/calcite/pull/4933#discussion_r3440102489
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -3261,8 +3069,10 @@ private void registerQuery(
if (orderList != null) {
// If the query is 'SELECT DISTINCT', restrict the columns
// available to the ORDER BY clause.
+ // DISTINCT ON is an exception: ORDER BY may reference columns
+ // not in the SELECT list.
final SqlValidatorScope selectScope3 =
- select.isDistinct()
+ (select.isDistinct() && !select.isDistinctOn())
Review Comment:
`SELECT DISTINCT DISTINCT ON(...) ` is also not support in PostgreSQL, we
can refer this link: https://onecompiler.com/postgresql/44sqp4qfd
--
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]