Bulk update in postgreSQL using unnest
<p>I am trying to do bulk update:</p>

<pre><code>&gt; 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;
</code></pre>

<p>However, when I read back:</p>

<pre><code>&gt; select id, ver, type, enabled from ti_table where id in ('2001622', '2001624', '2007903');
</code></pre>

<p>I see:</p>

<pre><code>   id    | ver | type  | enabled 
---------+-----+-------+---------
 2001622 |  15 | type1 | f
 2001624 |  14 | type1 | f
 2007903 |   8 | type1 | f
</code></pre>

<p>In the last two rows <strong>enabled</strong> is <code>false</code> while I expected it to be <code>true</code></p>

<p>Why is this happening and how would I do it correctly?</p>

<p>Thanks.</p>