my prior experience: - find_or_create does not work - rescuing RecordNotUnique - can deadlock mysql - behaves differently across mysql and postgres transaction semantics so you still need db-specific code e.g. savepoints
-
-
Replying to @mountain_ghosts @samphippen
I know they added some alternate form of this, which is just broken in a different way (INSERT and then SELECT on failure), and an actual upsert API
1 reply 0 retweets 0 likes -
Replying to @mountain_ghosts
Hey
@sgrif I'm sure you know about these things, would you care to weigh in?2 replies 0 retweets 0 likes -
Replying to @penelope_zone @samphippen and
Literally all I want is find_or_create_by to do an `on duplicate update` in postgres.
1 reply 0 retweets 3 likes -
"find or create" and "create or update" are different operations though
1 reply 0 retweets 1 like -
There’s also create or find by
1 reply 0 retweets 0 likes -
Replying to @penelope_zone @samphippen and
yeah I think that's the thing that does INSERT and then SELECT if that fails
1 reply 0 retweets 0 likes -
yup
1 reply 0 retweets 0 likes -
Replying to @penelope_zone @samphippen and
That also has a race condition where a DELETE can occur between INSERT and SELECT
1 reply 0 retweets 0 likes
Miss Dada 🏳️⚧️ Retweeted Miss Dada 🏳️⚧️
Miss Dada 🏳️⚧️ added,
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.