I am trying to do bulk update:
> update ti_table set enabled=T.enabled
from (select * from
unnest(array['2001622', '2001624', '2007903']) as id,
unnest(array[15,14,8]) as ver,
unnest(array['type1', 'type1', 'type1']) as type,
unnest(array[false, true, true]) as enabled) T
where ti_table.id=T.id AND ti_table.ver=T.ver AND ti_table.type=T.type;
However, when I read back:
> select id, ver, type, enabled from ti_table where id in ('2001622', '2001624', '2007903');
I see:
id | ver | type | enabled
---------+-----+-------+---------
2001622 | 15 | type1 | f
2001624 | 14 | type1 | f
2007903 | 8 | type1 | f
In the last two rows enabled is false
while I expected it to be true
Why is this happening and how would I do it correctly?
Thanks.