我尝试像更新其他值一样更新数组,例如:
update table set column = {'thing one','thing two'} where ...;
我得到这个错误:
ERROR: syntax error at or near "{"
我是PostgreSQL的新手,但是我找不到任何关于如何简单地用新数组替换整个数组的信息。
我明白了!数组必须用单引号括起来,数组内不能有引号!
update table set column = '{thing one, thing two}' where...;
由于我最终试图在Node.js中这样做,该方法将是这样的:
set column = '{${req.get("attribute")}}' //with quotes and brackets around the attribute you want to update!