Thread: RE: [HACKERS] Arrays broken on temp tables

RE: [HACKERS] Arrays broken on temp tables

From
"Ansley, Michael"
Date:
It's doing exactly what you told it to.

>> update tmpArray set val[3] = 7;
>> UPDATE 3
>> select * from tmpArray;
>> id|val
>> --+---------
>>  1|{1,2,7,4}
>>  2|{1,2,7,4}
>>  3|{1,2,7,4}
>> (3 rows)

You didn't specify which rows to update, so it updates all.  Try:

update tmpArray set val[3] = 7 where id = 2;

This should only update one row.

MikeA