princemaple
Different IDs getting conflicts
Ok this is… more than weird
It’s also consistent during insert_all with conflicts. I’m trying to back fill some missing data from backup, but can’t because the db thinks they are already there…
I can’t have 20+ uuids with conflicts, right? That’d be too luck. I checked they are totally different from what’s coming back from the db. Repo.all(from x in X, where: x.id in ^my_ids) I get these 20+ results with totally different ids, but consistent!
Marked As Solved
sevenseacat
Actually yeah I’ve seen weird behaviour like this with a corrupted index after an upgrade. Rebuilding indexes fixed it for me.
Also Liked
jswanner
FlyingNoodle
I have had some funky behaviour like this after a pg upgrade. I fixed it by running a vacuum.
princemaple
Thanks! I think these are the answers (vacuum / rebuild indices). I worked around by setting new IDs (because the things had this problem were not referenced elsewhere as fk, so it’s safe to do so) and I’m not sure if I will be able to confirm it’s the proper fix.
I indeed upgraded the db recently.
princemaple
Yup. The screenshot is a remote iex. v() simply refers to the previous return value.
garrison
From experience (and I’m sure any programmer will corroborate): bugs like this are virtually always something really stupid that you overlooked. We have all been there. But whatever it is, you’re the only one with the access to narrow it down.
Trying to reproduce in psql is a good way to rule some stuff out.









