From b153203fc04f540ff6c897d7587fe7d88e548ea0 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 18 Feb 2026 21:24:39 +0000 Subject: [PATCH] Fix CalendarEntryPost join: add explicit ON clause for polymorphic content_id content_id is a loose reference (no FK to posts.id), so SQLAlchemy cannot infer the join condition automatically. Co-Authored-By: Claude Opus 4.6 --- bp/calendar_entry/services/post_associations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bp/calendar_entry/services/post_associations.py b/bp/calendar_entry/services/post_associations.py index 0d60b2d..8796b73 100644 --- a/bp/calendar_entry/services/post_associations.py +++ b/bp/calendar_entry/services/post_associations.py @@ -97,7 +97,7 @@ async def get_entry_posts( """ result = await session.execute( select(Post) - .join(CalendarEntryPost) + .join(CalendarEntryPost, (CalendarEntryPost.content_id == Post.id) & (CalendarEntryPost.content_type == "post")) .where( CalendarEntryPost.entry_id == entry_id, CalendarEntryPost.deleted_at.is_(None)