SCOPE_IDENTITY returns the last identity inserted in the current scope — safer than @@IDENTITY when triggers exist. PostgreSQL exposes the inserted row via RETURNING in the same statement.
RETURNING
PostgreSQL
INSERT INTO orders (customer_id, total) VALUES (42, 199.90) RETURNING id AS new_id;