When you have primary keys generated by the database not by the application, then you might need it to be returned. In postgres you have to use RETURNING function in your sql query in order to have anything returned after insert. This example shows you how to use it, load the results as you do with regular select query.
Source code viewer
- INSERT INTO files (name, uri, type, size) VALUES ($1, $2, $3, $4) RETURNING id;Programming Language: PostgreSQL