RETURNING
A clause on INSERT, UPDATE or DELETE that returns the rows it wrote, such as the id of a new row.
In more detail
PostgreSQL has long supported it and SQLite since version 3.35. A follow-up SELECT does the same job portably.
Related terms
- INSERT — The SQL statement that adds new rows to a table.
- UPDATE — The SQL statement that changes values in existing rows, choosing the rows with WHERE and the new values with SET.
Taught in
- Inserting Data Safely — PostgreSQL, Indexing & Relational Data Modeling
- Isolation Levels And The Lost Update — PostgreSQL, Indexing & Relational Data Modeling