我正在尝试创建一个如下所示的简单准备语句,但是它会通过语法错误“在” Insert”处或附近”插入。但是,如果将插入物放在CTE中,则它不会出现问题。明显我在俯视吗?
这不起作用
"PREPARE stmt AS (INSERT INTO schema.table (col1, col2) VALUES ($1, $2))"
但这确实
"PREPARE stmt AS (WITH t1 AS (INSERT INTO schema.table (col1, col2) VALUES ($1, $2)) SELECT 1)"
答案 0 :(得分:0)
删除括号:
PREPARE stmt AS INSERT INTO schema.table (col1, col2) VALUES ($1, $2);