Closed sam-hunt closed 7 years ago
Posting a trap also fails. Likely related to changes made in #80. I think the method of enforcing permissions used may be completely borked.
The unique constraint violation triggers, yet upon inspecting the database, no smoking gun records were found. This suggests that the INSERT is attempting to insert multiple identical rows instead of just the one we expect. This is then failing, and the entire transaction is being rolled back, removing the incriminating records with it.
I think the SQL pattern is completely wrong for multiple tables. Going to try using a SELECT CTE, and then using that in the WHERE, as I've done with other ones.
Yeah the select cte is way better. Much tidier, and more logical to read. Also minus the duplicate row bug.
Seems to be an issue with the unique constraint on the table.