我想用 Korma 执行以下原始 SQL:
k/exec-raw
["INSERT INTO events ?, VALUES ? ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title;" [keys values]]
参数等于:
keys (str "(" (keys->str res) ")")
values (str "(" (serialize (merge res) ", ") ")" )
两者都评估以纠正字符串并在 repl 中工作。
但是在运行时我在 psql 控制台中有以下错误:
ERROR: syntax error at or near "$1" at character 20
STATEMENT: INSERT INTO events $1, VALUES $2 ON CONFLICT (id) DO UPDATE SET title = EXCLUDED.title
无法弄清楚是什么问题。有人用 Korma 做过插入吗?
PostgreSQL 9.5 + 科尔马 0.4.2