Skip to content

Conversation

@egormanga
Copy link
Contributor

Description of Changes

SQL RETURNING for DML to return affected rows to the caller:

INSERT INTO test (a, b)
VALUES (1, 2)
RETURNING *;

gives:

 a | b 
---+---
 1 | 2 

(same goes for UPDATE & DELETE).

Individual columns can be specified, too — separately from the fields the statement operates on:

UPDATE test
SET a = 1
WHERE b < 2
RETURNING b;

allowing to efficiently combine DML with implicit SELECTs.

API and ABI breaking changes

None.

Expected complexity level and risk

2.

Testing

  • Manual testing
  • Unit tests

@bfops
Copy link
Collaborator

bfops commented Jan 6, 2026

Thank you for filing this! We'll work on getting a reviewer on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants