Given a table:
CREATE TABLE t (
k text,
v1 int,
v2 int,
PRIMARY KEY (k)
)
Is it possible to set v1
to some value and delete (set to null) v2
with a single query? Something like:
UPDATE t SET v1=100, v2=NULL WHERE k='somekey';
I have looked through the docs, but found nothing.
It would be a nice to have feature for two reasons:
- Updating a table with a lots of columns using prepared statements is really painful now.
- If my understanding is correct, row update by a single query should be atomic, whereas there are no guarantees for two consequent queries.