Skip to content

SQL: ORDER BY COUNT(*) should display an error message #34590

@astefan

Description

@astefan

The following behavior should return an error message about the limitations of ORDER BY, but instead is returning some seemingly incorrect results:

sql> select languages,count(*) from test_emp group by languages having count(*) > 10 order by count(emp_no);
   languages   |   COUNT(1)
---------------+---------------
1              |15
2              |19
3              |17
4              |18
5              |21

composite aggregation (what is used in any group by sql statements) cannot order on something else other than the key itself (in this case - languages). But, instead of returning an error message, it gives the false impression that the results are incorrect.

Related to #31860.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions