uqa_sql/semantics/parameters/setting.rs
1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! One parameter's value in a session, as `pg_settings` and `SHOW ALL` report it.
8
9use super::definition::ParameterDefinition;
10
11/// A parameter's value in a session, with the value `RESET` restores and where the current value came from.
12#[derive(Clone, Debug)]
13pub struct ParameterSetting {
14 pub definition: &'static ParameterDefinition,
15 /// The setting in base units, as `pg_settings.setting` reports it.
16 pub setting: String,
17 /// The setting `RESET` restores, as `pg_settings.reset_val` reports it.
18 pub reset_setting: String,
19 /// Where the setting came from, as `pg_settings.source` reports it: `default`, `client`, `override` or `session`.
20 pub source: &'static str,
21}
22
23impl ParameterSetting {
24 /// The setting as `SHOW` reports it.
25 pub fn shown(&self) -> String {
26 super::value::show_setting(self.definition, &self.setting)
27 }
28}