Repository navigation
Description
SET LOCAL statement_timeout TO DEFAULT currently resets the session timeout
when issued outside a transaction. The parser drops is_local for DEFAULT, so
the existing SET LOCAL warning/no-op handling is bypassed. This branch retains
that flag and restores PostgreSQL-compatible behavior.
Reproduction: send these as three separate requests on the same connection,
without BEGIN. A single multi-statement request is not equivalent because it
can create an implicit transaction.
SET statement_timeout TO '5s';
SET LOCAL statement_timeout TO DEFAULT;
SHOW statement_timeout;
On unchanged main, SHOW returns 0. Direct PostgreSQL preserves 5s and emits
WARNING / SQLSTATE 25P01. The patched PgDog behaves like PostgreSQL with both
simple and extended protocol requests, on single-database and sharded endpoints.
The production change is one parser field assignment. Tests cover the LOCAL
flag, warning, unchanged session timeout, and ordinary SET DEFAULT, SET SESSION
DEFAULT, and RESET behavior. Transaction-local reset bookkeeping inside an
explicit transaction is outside this branch's scope.
This is a follow-up to the existing SET LOCAL outside-transaction handling:
#1685
Branch: https://github.com/anna-poutanen/pgdog/tree/codex/set-local-default
Base: 20f65c0
Commit: eed3865
Validation on this exact base: 2,773 workspace unit tests and all 202
enabled Rust integration tests passed. Formatting, workspace Clippy with
-D warnings, workspace build, and doc tests (20 passed) also passed. The
new regression fails at its intended assertion on unchanged main. Nine unit
tests and five integration tests remain excluded by their configured profiles.
The broader Linux/multi-language/Docker CI matrix has not been run locally.
Focused reproduction commands, after fixture setup and starting PgDog:
cargo nextest run -p pgdog --profile dev -E 'test(test_set_local_default_) | test(test_set_default_and_reset_remain_session_scoped)'
cargo nextest run -p integration_tests_rust --profile integration -E 'test(=integration::reset::set_local_default_outside_transaction_preserves_timeout)'
I have prepared this as a fork-branch contribution following CONTRIBUTING.md.
I would appreciate review of this focused fix.
Activity
fix: preserve LOCAL for SET DEFAULT (#1778)