I also suspected that passing in a String or Number injected inside of the array selection is not valid in parameterized queries since it would be the SQL language syntax instead of an individual value to check against. However, testing with a simple selection it doesn't seem like the dynamic value is the issue here:
Hmmm, I do not see how just adding the parens gets it work in a SELECT query. Still not working in the UPDATE query though, get syntax errors in various places.
Tried various versions from just adding the parens, assuming ARRAY(1,2,3,4) is a stand in for my array column:
Update routing
set (leg_lines[{{index}}]) = {{lines}}
where route_id = {{selRoutes.selectedItem.route_id}});
Update routing
set (leg_lines)[{{index}}] = {{lines}}
where route_id = {{selRoutes.selectedItem.route_id}});
I also to inserting the whole ARRAY function in case this whole thing was a back door way of passing the index (pg arrays are 1 based):
Update routing
set leg_lines[(ARRAY[1,2,3])[{{index}}]] = {{lines}}
where route_id = {{selRoutes.selectedItem.route_id}});
Hey @bradlymathews! Puzzling Out of curiosity, how are you passing in your {{ index }} and {{ lines }} values? Are they confirmed to be integers that match the values you've tested hardcoding with?