Skip to content

fix(router): pass SET ... FROM CURRENT through to the server - #1721

Open
BABTUNA wants to merge 1 commit into
pgdogdev:mainfrom
BABTUNA:fix/reset-all-multi-statement-panic
Open

BABTUNA wants to merge 1 commit into
pgdogdev:mainfrom
BABTUNA:fix/reset-all-multi-statement-panic

Conversation

@BABTUNA

@BABTUNA BABTUNA commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1729, from the review here.

SET x FROM CURRENT sets a parameter to its current value, so it doesn't change session state. It now passes through as Command::Query like SET TRANSACTION instead of returning UnsupportedSetKind. In a multi-statement query it's still split out and handled on its own.

Added test_set_from_current_passthrough covering both cases.

@CLAassistant

CLAassistant commented Oct 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

MultiStatementSafety,

#[error("SET ... FROM CURRENT is not supported")]
SetFromCurrent,

@levkk levkk Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to raise this error. This is a no-op as far as I can tell, since the value of the parameter doesn't change. This is equivalent to SHOW param and SET param TO value_returned_by_show.

We could probably just pass it through as Command::Query.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, it's a no-op on the server. Changed it to pass through as Command::Query like SET TRANSACTION, and dropped the error.

SET ... FROM CURRENT sets a parameter to its current value, so it doesn't
change session state. Route it like SET TRANSACTION instead of returning
UnsupportedSetKind.
@BABTUNA
BABTUNA force-pushed the fix/reset-all-multi-statement-panic branch from b60b97f to 0568106 Compare October 10, 2026 00:39
@BABTUNA BABTUNA changed the title fix(router): don't panic on RESET ALL in multi-statement queries fix(router): pass SET ... FROM CURRENT through to the server Oct 10, 2026

This branch has not been deployed

No deployments
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.

3 participants