builk_create upsert seems to be broken
I have the following create in my resource:
the
upsert_identity comes from this identity:
Just so you know, the :uid field is not a primary key.
If I try to insert a row with the same uid as one that already exists in the DB using the create funciton, it works as expected and I get the ON CONFLICT ("uid") in the SQL query.
Now, if I try to do the same, but with a bulk_create call, the resulti SQL query will contain ON CONFLICT ("id"), in other words, it uses id instead of uid which was set by the upsert_identity function.10 Replies
Interesting...so its ignoring the
upsert_identity on the action?
what if you pass upsert_identity :unique_uid option when calling the bulk create?Like this right?
It still ignores it:
🤔 we have multiple tests for this behavior
are you on the latest of everything?
Yep, latest version:
what if you remove the
upsert_identity from the action itself? And just pass upsert?: true and upsert_identity as the option?If I do that it works fine
gotcha, okay, so using the action
upsert_identity is what causes the problem
can you an open an issue for this on ash? I think its an ash core thingGitHub
bulk_create ignores
upsert_identity if set directly in the action...Describe the bug Setting a upsert_identity to the action will be ignored by a bulk_create function call. To Reproduce Just add a upsert_identity to a create action and then try to run bulk_create. ...
can you try
main?Yep, working on main 🚀