MCPcopy Create free account
hub / github.com/PostHog/duckgres / normalizeSearchPathSet

Function normalizeSearchPathSet

transpiler/transform/setshow.go:383–405  ·  view source on GitHub ↗
(stmt *pg_query.VariableSetStmt)

Source from the content-addressed store, hash-verified

381 // do NOT forward to DuckDB (it would reject the unknown setting).
382 // RESET / SET ... TO DEFAULT restore the default (empty value).
383 // SET LOCAL is treated the same as SET here (there is no
384 // transaction-scoped restore for this billing GUC). The value is a
385 // billing dimension, so it is validated against the closed
386 // {standard, endpoints} set (case-insensitively, normalized to
387 // lowercase); anything else — including a value that is not a
388 // single simple constant/identifier — is rejected with 22023 via
389 // result.Error, which every protocol path (simple, split-batch,
390 // extended Parse) surfaces before storing anything on the session.
391 if paramName == querySourceParam && !multiStatement {
392 value := ""
393 if n.VariableSetStmt.Kind == pg_query.VariableSetKind_VAR_SET_VALUE {
394 extracted := false
395 if len(n.VariableSetStmt.Args) == 1 {
396 if v, ok := searchPathValue(n.VariableSetStmt.Args[0]); ok {
397 value, extracted = v, true
398 }
399 }
400 if !extracted {
401 // Multiple values / a non-string constant can never
402 // name a valid query source; reject rather than
403 // silently resetting to the default.
404 result.Error = errInvalidQuerySource()
405 return true, nil
406 }
407 }
408 norm, err := NormalizeQuerySource(value)

Callers 1

TransformMethod · 0.85

Calls 1

searchPathValueFunction · 0.85

Tested by

no test coverage detected