我正在尝试进行批量更新:
> 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;
然而,当我回读时:
> select id, ver, type, enabled from ti_table where id in ('2001622', '2001624', '2007903');
我懂了:
id | ver | type | enabled
---------+-----+-------+---------
2001622 | 15 | type1 | f
2001624 | 14 | type1 | f
2007903 | 8 | type1 | f
在启用的最后两行中false
,我希望它是true
为什么会发生这种情况,我将如何正确地做到这一点?
谢谢。