princemaple

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

sevenseacat

Author of Ash Framework

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

jswanner

@princemaple,

odd question, but just making sure…

Is id the primary key field on the schema?

FlyingNoodle

FlyingNoodle

I have had some funky behaviour like this after a pg upgrade. I fixed it by running a vacuum.

princemaple

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

princemaple

Yup. The screenshot is a remote iex. v() simply refers to the previous return value.

garrison

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.

Where Next?

Popular in Questions Top

New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement