Repository navigation
Add set_config and the transaction mode checks after a query - #163
Merged
Merged
Conversation
This was referenced Oct 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
set_config, which isSETas a function, and the rule that a transaction cannot change its isolation level after its first query. With it, the session item of M2 is complete.What changes
rupg-funchas the kernel ofset_config_by_name. A null name gives22004, a null value resets the parameter, and a nullis_localis false, as inguc_funcs.c.Sessiontrait ofrupg-funchasset_setting. The reader ofrupg-sessionchanges the settings of the connection through aRefCell, with the same checks asSET, the check ofroleandsession_authorizationincluded. The change counts for the rest of the query. The zone ofTimeZoneis made again when the setting changes, soSession::zonenow gives anRc.SETalready uses, and a local change ends with its transaction. A changed reported parameter, such asTimeZone,DateStyleorsearch_path, is reported beforeReadyForQuery.Settingsknows when the transaction took its first snapshot, asFirstSnapshotSetdoes. A query takes it when it is analyzed in aQueryor aParsemessage, and inBindandExecute. After it,check_transaction_isolation,check_transaction_deferrableandcheck_transaction_read_onlygive25001.SHOWand the other utility statements take no snapshot.Tests
set_configsends 44 queries to a connection and checks the rows, the errors and theParameterStatusmessages. Each expected value is the output of the PostgreSQL 19 oracle for the same statement.transaction_modes_after_a_querychecksSET TRANSACTIONafter a query in a block, in an implicit block and afterParse, against the oracle.cargo fmt,cargo clippy --workspace --all-targets -D warnings,cargo test --workspaceand thecargo xtaskchecks pass on server1.