Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pgdog/src/frontend/router/parser/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,14 @@ impl<'a> QueryParserContext<'a> {
pub(super) fn expanded_explain(&self) -> bool {
self.expanded_explain
}

/// Are we running in session mode?
///
/// In session mode, queries are forwarded to the server without
/// parsing or validation beyond what's required for routing.
pub(super) fn is_session_mode(&self) -> bool {
self.router_context
.cluster
.pooler_mode() == crate::config::PoolerMode::Session
}
}
8 changes: 8 additions & 0 deletions pgdog/src/frontend/router/parser/query/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,19 @@ impl QueryParser {
/// - All SETs → returns `Ok(Some(Command::Set { .. }))`
/// - No SETs → returns `Ok(None)`, caller falls through to default parsing
/// - Mix of SET + non-SET → returns `Err(MultiStatementMixedSet)`
///
/// In session mode, the entire check is bypassed (`Ok(None)`) so that
/// all multi-statement queries are forwarded to the server verbatim.
pub(super) fn try_multi_set(
&mut self,
stmts: &[RawStmt],
context: &QueryParserContext,
) -> Result<Option<Command>, Error> {
// In session mode, pass through without validation — the server
// owns the session and can handle mixed SET + other statements.
if context.is_session_mode() {
return Ok(None);
}
let mut params = Vec::with_capacity(stmts.len());
let mut has_set = false;
let mut has_other = false;
Expand Down
Loading