I have a table:
create table detailids(detail_id integer);
I'm trying to do this:
insert into detailids ( insert into another_table(a bunch of values)
(select id from temp_table where temp_table.type = 'smth')
returning id);
I get this error though:
ERROR: syntax error at or near "insert"
I don't understand why my syntax doesn't work! According to the Postgres documentation:
If the INSERT command contains a RETURNING clause, the result will be similar to that of a SELECT statement containing the columns and values defined in the RETURNING list, computed over the row(s) inserted by the command.
I've also tried to run it by specifying the specific column name detailids(detail_id)
, to no avail!
Why?!?
Thanks for reading.