Is something like this possible?
INSERT INTO Table2 (val) VALUES ((INSERT INTO Table1 (name) VALUES (\'a_title\') RETURNING id));
like usin
The best practice for this situation. Use RETURNING … INTO.
INSERT INTO teams VALUES (...) RETURNING id INTO last_id;
Note this is for PLPGSQL