I'm currently working on a project where I need to use the ANY keyword in a SQL query, and I'm curious about its atomicity. Specifically, I'm using it in the context of updating rows in a cockroachdb with Go, similar to the following query:
UPDATE table
SET active = NULL
WHERE id = ANY($1);
I understand that the ANY keyword is used for comparisons, but I'm wondering if this operation is considered atomic by itself or if additional measures (like transactions) are needed to ensure atomicity?
I haven't wrapped it in a transaction for now.
The ANY keyword doesn't affect UPDATE's atomicity gaurantees.
Here is an example in CockroachDB to reaffirm the above statement:
The ANY keyword's role is purely for comparison within queries. As demonstrated above, all changes made by UPDATE either all succeed or all fail - there is no middle state.