我有一张桌子:
create table detailids(detail_id integer);
我正在尝试这样做:
insert into detailids ( insert into another_table(a bunch of values)
(select id from temp_table where temp_table.type = 'smth')
returning id);
我得到了这个错误:
ERROR: syntax error at or near "insert"
我不明白为什么我的语法不起作用!根据Postgres 文档:
如果 INSERT 命令包含 RETURNING 子句,则结果将类似于 SELECT 语句的结果,该语句包含在 RETURNING 列表中定义的列和值,根据命令插入的行计算。
我也尝试通过指定特定的列名来运行它detailids(detail_id)
,但无济于事!为什么?!?
谢谢阅读。