I have a problem when I try to update many rows at the same time.
Here is the table and query I use (simplified for better reading):
table<
Your script will create a temporary table from foo. It will have the same data types as foo. Use an impossible condition so it is empty:
select x, y, pkid
into temp t
from foo
where pkid = -1
Make your script to insert into it:
insert into t (x, y, pkid) values
(null, 20, 1),
(null, 50, 2)
Now update from it:
update foo
set x=t.x, y=t.y
from t
where foo.pkid=t.pkid
Finally drop it:
drop table t