jackwener commented on issue #4556:
URL:
https://github.com/apache/arrow-datafusion/issues/4556#issuecomment-1342399709
`standard sql` disallow `groupby` or `having` use the alias in `select list`.
But, pg allow `groupby` use alias in `select list` but disallow `having` use
alias.
so strange things.
```sql
-- create
CREATE TABLE EMPLOYEE (
empId INTEGER PRIMARY KEY,
age INTEGER NOT NULL,
name TEXT NOT NULL
);
-- insert
INSERT INTO EMPLOYEE VALUES (0001, 0020, 'Sales');
--ok
select max(empId), age as a from EMPLOYEE group by a;
--failed
select max(empId), age as a from EMPLOYEE group by a > 3;
-- ok
select max(empId), (age + empId) as a from EMPLOYEE group by a;
-- failed
select max(empId), (age as a + empId) as a from EMPLOYEE group by (a +
empId);
```
--
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]