Atomic array removal
Greetings!
I'm attempting to remove an element from a string array attribute from all records that have it, but do it atomically with psql's
array_remove
. I have the following change:
When I try: Ash.bulk_update!(MyResource, :remove_thing, %{thing_id: thing_id})
, it returns the following error:
Could not use ":atomic": Cannot atomically update MyResource.thing_ids: Cannot cast a non-literal list atomically
Is this just not doable or am I doing it wrong?
Thanks2 Replies
Do
atomic_update {:atomic, expr(...)}
to bypass the type casting of arrays (which is unnecessary in this case)Doh. Just adding the option
cast_atomic?: false
did the trick. Thanks!