You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Phalcon Query Builder checks if the (full) group by syntax exists in the model, while it should only check the column name or perhaps skip the check entirely. In MySQL you can specify the alias for the group by clause as specify in the column select, for Postgres this isn't allowed.
Fatal error: Uncaught Phalcon\Mvc\Model\Exception: Column 'DATE_PART('year', invoiceDate)' doesn't belong to any of the selected models (1), when preparing: SELECT DATE_PART('year', invoiceDate) year, countryId, SUM(count) count FROM [InvoiceStatistic] GROUP BY [DATE_PART('year', invoiceDate)], [countryId] in /www/public/index.php:61
Describe the bug
Phalcon Query Builder checks if the (full) group by syntax exists in the model, while it should only check the column name or perhaps skip the check entirely. In MySQL you can specify the alias for the group by clause as specify in the column select, for Postgres this isn't allowed.
To Reproduce
Steps to reproduce the behavior:
Consider following model:
Create table syntax:
Executing code:
Throws the following exception:
Expected behavior
No error, group by should work as expected.
Error caused by Exception at: https://github.com/phalcon/cphalcon/blob/v5.7.0/phalcon/Mvc/Model/Query.zep#L3025
Details
php --ri phalcon
)5.6.2
(also applicable in5.7.0
)8.3
Alpine Linux 3.19
Compiling from source
0.17.0
Apache / PHP-FPM
Postgres 16.1
The text was updated successfully, but these errors were encountered: