Skip to content

RETURNING

INSERT INTO person(first_name, last_name)
VALUES ('John', 'Doe')
RETURNING person_id;
person_id
-----------
1

The RETURNING clause in PostgreSQL allows to return the specific, updated row after an INSERT, UPDATE or DELETE operation. In this example, after inserting the new row (‘John’, ‘Doe’) into person table, the person_id of the new row is returned.