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

Group by error #5

Closed
atillay opened this issue Apr 16, 2023 · 2 comments
Closed

Group by error #5

atillay opened this issue Apr 16, 2023 · 2 comments

Comments

@atillay
Copy link

atillay commented Apr 16, 2023

Hello,
I'm using your bundle on Symfony 6.2 with PHP 8.2 and PostgreSQL 14.1.
I've got a group by error on the ranky/media/filters endpoint.
Did I miss something ? Before it was working because I was using MySQL with disabled ONLY_FULL_GROUP_BY

The query that fails :

SELECT EXTRACT(YEAR FROM r0_.created_at) AS sclr_0, EXTRACT(MONTH FROM r0_.created_at) AS sclr_1, count(r0_.id) AS sclr_2 
FROM ranky_media r0_ GROUP BY sclr_0, sclr_1 ORDER BY r0_.created_at ASC;

And the error :

An exception occurred while executing a query: SQLSTATE[42803]: Grouping error: 7 ERROR: column "r0_.created_at" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ... ranky_media r0_ GROUP BY sclr_0, sclr_1 ORDER BY r0_.create...
@chiqui3d
Copy link
Contributor

I apologize for the inconvenience. I use MariaDB and SQLite for testing, and they did not report this error. I will fix it tomorrow. The issue is with the orderBy clause and the createdAt field. As the error message indicates, I am using this field but I have not specified it either in an aggregation function or in the GroupBy clause

chiqui3d added a commit that referenced this issue Apr 17, 2023
The original ORDER BY included a field that was not present in the GROUP BY clause or any aggregate function
@chiqui3d
Copy link
Contributor

chiqui3d commented May 9, 2023

I close the issue, since it should be fixed.

@chiqui3d chiqui3d closed this as completed May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants