I am trying to use a with clause with postgres insert statement
with inserted_record as (insert into person_age(person_name, years_old) values ('asnim', 21) returning *);
However, it errors out like
SQL Error [42601]: ERROR: syntax error at end of input
Position: 108
If i run it with without the the with clause it works
insert into person_age(person_name, years_old) values ('asnim', 21) returning *;
What am I missing here?
withclause that doesn't happen in normal insert? Cause yeah, normal insert works, there doesn't appear to be a need for anything more complex.inserted_recordand use its id as foreign key in another table.