Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-16189 wrong order by and group by generated #6237

Merged
merged 2 commits into from Mar 17, 2023

Conversation

dreab8
Copy link
Member

@dreab8 dreab8 commented Mar 13, 2023

Copy link
Contributor

@beikov beikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to add @RequiresDialect(H2Dialect.class) to OrderByAndAggregateFunctionTest because not every database supports functional dependency analysis.

Also, it would be interesting to see what happens if the id attribute is an embeddable.

@dreab8
Copy link
Member Author

dreab8 commented Mar 14, 2023

yeap. Derby, Oracle, DB2 and SQLServer were failing, they want the id to be present in both the group and order by.

I had also changed https://github.com/hibernate/hibernate-orm/pull/6237/files#diff-d177a632e40c816cc34f0e75e48cfd23535d0f7c626597bfc4adbaf861b72514R79 adding || currentClause == Clause.ORDER || currentClause == Clause.HAVING to avoid failure of queries like

select c.id, sum(p.number) " +
"from Parent p " +
"inner join p.child c " +
"group by c.id " +
"order by c.id

and

"select c.id, sum(p.number) " +
"from Parent p " +
"inner join p.child c " +
"group by c.id " +
"having c.id > 5",

I'm going to check with embeddables

@dreab8 dreab8 force-pushed the HHH-16189 branch 2 times, most recently from be931b3 to 57605b1 Compare March 16, 2023 09:12
@dreab8
Copy link
Member Author

dreab8 commented Mar 16, 2023

Copy link
Contributor

@beikov beikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like EmbeddedIdOrderByAndAggregateFunctionTest is failing on PostgreSQL.

@dreab8 dreab8 force-pushed the HHH-16189 branch 2 times, most recently from 3ad565e to 3c80be2 Compare March 17, 2023 13:51
@beikov beikov merged commit 664b10a into hibernate:main Mar 17, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants