putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.

Home Page:https://putyourlightson.com/plugins/blitz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in Blitz Diagnostics when using PosgreSQL

borisklotz opened this issue · comments

Bug Report

I just updated the plugin to the latest version. Now I get the following error when I go to Blitz Diagnostics > Tracked Elements and click on one of the listed element types:

SQLSTATE[42803]: Grouping error: 7 ERROR: column "elementexpirydates.expiryDate" must appear in the GROUP BY clause or be used in an aggregate function
LINE 2: FROM (SELECT "elementcaches"."elementId", "elementexpirydate...
^
The SQL being executed was: SELECT COUNT(*)
FROM (SELECT "elementcaches"."elementId", "elementexpirydates"."expiryDate", count(*) AS "count", "title"
FROM "blitz_elementcaches" "elementcaches"
INNER JOIN "blitz_caches" ON "elementcaches"."cacheId" = "blitz_caches"."id"
LEFT JOIN "blitz_elementexpirydates" "elementexpirydates" ON "elementexpirydates"."elementId" = "elementcaches"."elementId"
INNER JOIN "elements" "elements" ON "elements"."id" = "elementcaches"."elementId"
INNER JOIN "content" "content" ON "content"."elementId" = "elementcaches"."elementId"
WHERE ("blitz_caches"."siteId"=1) AND ("content"."siteId"=1) AND ("type"='craft\elements\Entry')
GROUP BY "elementcaches"."elementId", "title"
ORDER BY "count" DESC) "c"

We are using PostgreSQL, so the error might only be related to this particular RDBMS.

Plugin Version

4.11.1

Craft CMS Version

4.7.3

PHP Version

8.1.0

Thanks for reporting that!

Fixed in 84fe788 and released in 4.11.2.