postgresql 错误:Postgres SQL中的“[”处或附近有语法错误

cdmah0mi  于 2023-04-29  发布在  PostgreSQL
关注(0)|答案(1)|浏览(229)
UPDATE s SET sb = sb ||
                  ('{"filded": [{"@value": ' ||
                  sb@>>'{filded,0, @value}'::integer + 1 ||
                  '}],"lastFailure ": '[{"@t": "DateTime", "@value": "$1"}],ln": '[{"@type": "DateTime", "@value": "$1"}])::jsonb
WHERE sbi=$2

这是我的postgres sql查询,我试图在这个pgAdmin中运行,但它给出错误

ERROR:  syntax error at or near "["
LINE 1: ...d,0, @value}'::integer + 1 ||'}],"lastFailure ": '[{"@t": "D...
                                                             ^
SQL state: 42601
Character: 116
2ic8powd

2ic8powd1#

只是对你的烂摊子的猜测:

UPDATE s
SET    sb = sb
         || ('{"filded":[{"@value":'
         || (sb #>> '{filded,0,@value}')::integer + 1
         || '}], "lastFailure":[{"@t":"DateTime", "@value":"$1"}], "ln":[{"@type":"DateTime", "@value":"$1"}]}')::jsonb
WHERE  sbi = $2;

相关问题