In ticket summary SQL query, group by ticket ID, not by discussion ID
Each ticket has a single discussion ID, and each ticket has a unique one, so, given an inner join of tickets and discussions, I think there should be exactly 1 way select a (ticket, discussion) pair given any of these. But for some reason, PostgreSQL started complaining. Not sure what changed. Anyway, for now, I switched the groupBy from discussion.id to ticket.id, which is essentially the same, but for some reason makes PostgreSQL happy. It can't tell that given a discussion ID, there's exactly 1 way to choose the ticket. Or something like that. I wonder if I messed up something in DB migrations.
This commit is contained in:
parent
b8c669f6fc
commit
50f12f855d
1 changed files with 1 additions and 1 deletions
|
@ -64,7 +64,7 @@ getTicketSummaries mfilt morder jid = do
|
||||||
on $ p ^. PersonIdent ==. s ^. SharerId
|
on $ p ^. PersonIdent ==. s ^. SharerId
|
||||||
on $ t ^. TicketCreator ==. p ^. PersonId
|
on $ t ^. TicketCreator ==. p ^. PersonId
|
||||||
where_ $ t ^. TicketProject ==. val jid
|
where_ $ t ^. TicketProject ==. val jid
|
||||||
groupBy $ d ^. DiscussionId
|
groupBy $ t ^. TicketId
|
||||||
for_ mfilt $ \ filt -> where_ $ filt t
|
for_ mfilt $ \ filt -> where_ $ filt t
|
||||||
for_ morder $ \ order -> orderBy $ order t
|
for_ morder $ \ order -> orderBy $ order t
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue