Skip to content

feat(postgres): allow multi-statement queries that pass the role policy#168

Merged
mslipper merged 1 commit into
mainfrom
feat/postgres-multi-statement
May 29, 2026
Merged

feat(postgres): allow multi-statement queries that pass the role policy#168
mslipper merged 1 commit into
mainfrom
feat/postgres-multi-statement

Conversation

@mslipper

Copy link
Copy Markdown
Contributor

Replaces the statement-count rejection in the Postgres proxy with per-statement classification. A multi-statement Simple Query is now forwarded as long as every statement passes the role policy; the batch is rejected if any statement mutates the role (SET ROLE / set_config('role', ...)) or is a DO block. The wire relay is unchanged since the Query passthrough already forwards the whole message and multiple result sets already stream back, so the upstream runs the batch as one implicit transaction. Removes the now-unused OpMulti / RejectMultiStatement.

Replace the statement-count rejection with per-statement classification.
A multi-statement Simple Query is now forwarded as long as every
statement passes the role policy; the batch is rejected if any statement
mutates the role (SET ROLE / set_config('role',...)) or is a DO block.

The wire relay is unchanged: the Query passthrough already forwards the
whole message and serverToClient already streams back multiple result
sets, so the upstream runs the batch as one implicit transaction.

Removes the now-unused OpMulti / RejectMultiStatement.
@mslipper mslipper merged commit 6326e3f into main May 29, 2026
6 of 7 checks passed
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.

1 participant