solspace / craft-calendar

Calendar for Craft: The most reliable and powerful event management plugin for Craft.
http://docs.solspace.com/craft/calendar/v5
Other
15 stars 14 forks source link

Events not loading with PostgreSQL #214

Closed boboldehampsink closed 1 year ago

boboldehampsink commented 1 year ago

Describe the bug or issue you're experiencing

Events are not loading in the CP in the calendar with PostgreSQL, spinner keeps spinning and seeing the following 500 error in the logs:

SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax for type integer: ""
The SQL being executed was: SELECT "elements"."id"
FROM (SELECT "elements"."id" AS "elementsId", "elements_sites"."id" AS "elementsSitesId", "content"."id" AS "contentId"
FROM "elements" "elements"
INNER JOIN "calendar_events" "calendar_events" ON "calendar_events"."id" = "elements"."id"
INNER JOIN "elements_sites" "elements_sites" ON "elements_sites"."elementId" = "elements"."id"
INNER JOIN "content" "content" ON ("content"."elementId" = "elements"."id") AND ("content"."siteId" = "elements_sites"."siteId")
INNER JOIN "calendar_calendars" ON "calendar_calendars"."id" = calendar_events."calendarId"
LEFT JOIN "users" ON "users"."id" = calendar_events."authorId"
WHERE (calendar_events."calendarId" IN ('', '1', '2')) AND ((calendar_events."rrule" IS NULL AND calendar_events."endDate" >= '2023-02-27 00:00:00')
                OR (calendar_events."rrule" IS NOT NULL AND calendar_events."until" IS NOT NULL AND calendar_events."until" >= '2023-02-27 00:00:00')
                OR (calendar_events."rrule" IS NOT NULL AND calendar_events."until" IS NULL)
                OR (calendar_events."freq" = 'SELECT_DATES')) AND (calendar_events."startDate" <= '2023-04-10 23:59:59' OR calendar_events."freq" = 'SELECT_DATES') AND ("elements_sites"."siteId"='12') AND ("elements"."archived"=FALSE) AND ("elements"."dateDeleted" IS NULL) AND ("elements"."draftId" IS NULL) AND ("elements"."revisionId" IS NULL)
ORDER BY "startDate") "subquery"
INNER JOIN "calendar_events" "calendar_events" ON "calendar_events"."id" = "subquery"."elementsId"
INNER JOIN "elements" "elements" ON "elements"."id" = "subquery"."elementsId"
INNER JOIN "elements_sites" "elements_sites" ON "elements_sites"."id" = "subquery"."elementsSitesId"
INNER JOIN "content" "content" ON "content"."id" = "subquery"."contentId"
INNER JOIN "calendar_calendars" ON "calendar_calendars"."id" = calendar_events."calendarId"
LEFT JOIN "users" ON "users"."id" = calendar_events."authorId"
ORDER BY "startDate"

See also https://reggeborgh.sentry.io/share/issue/5dd0703ad7a84f5a83ab75876c1e9674/ for a stack trace.

Steps to reproduce

  1. Use PostgreSQL (13.9 in my case)
  2. Try to load calendar in CP

Expected behavior

This should work on PostgreSQL

Craft & Plugin Info (please complete the following information):

Additional context

https://reggeborgh.sentry.io/share/issue/5dd0703ad7a84f5a83ab75876c1e9674/

kjmartens commented 1 year ago

Sorry for the trouble @boboldehampsink. We'll have a fix for this available shortly. In the meantime, you can try removing this line specifically and see if it resolves the issue: https://github.com/solspace/craft-calendar/commit/270ec8c35cd20db7c3d8cde987e7ea2cb99b8ca1

Or update to dev-v3 as 3.3.20.1 🙂

boboldehampsink commented 1 year ago

@kjmartens I tried and it works!

kjmartens commented 1 year ago

Thanks @boboldehampsink 🙂

kjmartens commented 1 year ago

This should now be fixed in Calendar 3.3.21+ and 4.0.8+. 🙂