RETURNING
RETURNING is a SQL clause in the PostgreSQL Specific category. PostgreSQL extension that returns values from INSERT/UPDATE/DELETE statements (like OUTPUT in SQL Server). The syntax is INSERT/UPDATE/DELETE ... RETURNING column1, column2;. It returns result set from DML. A typical example: INSERT INTO users (name) VALUES ('Alice') RETURNING id; -- Returns the new user's ID immediately DELETE FROM users WHERE id = 5 RETURNING name; -- Returns the name of the deleted user A close relative is SERIAL, which postgreSQL auto-increment type. Creates an INTEGER column with a sequence. Equivalent to AUTO_INCREMENT in MySQL. A close relative is ARRAY, which postgreSQL supports array columns and array operations. Can be multi-dimensional. A close relative is JSONB, which postgreSQL binary JSON type, more efficient than plain JSON. Supports indexing (GIN) and path queries. More about this category: PostgreSQL-specific features — SERIAL, RETURNING, ARRAY, JSONB, UPSERT. Related PostgreSQL Specific entries: SERIAL, ARRAY, JSONB, UPSERT (INSERT ON CONFLICT), ILIKE, BIGSERIAL / SMALLSERIAL, GENERATED AS IDENTITY, COPY.