From f0ac5af7926552628e7a4164f712e7a6a36356b4 Mon Sep 17 00:00:00 2001 From: Sean Wu <111744549+VWagen1989@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:14:43 +0800 Subject: [PATCH] feat(pg): supports SET/SHOW statement (#193) --- main.go | 7 +- pgserver/config/parameters.go | 273 ++ pgserver/config/parameters_list.go | 4101 ++++++++++++++++++++++++++++ pgserver/connection_handler.go | 168 +- pgtest/server.go | 2 + 5 files changed, 4507 insertions(+), 44 deletions(-) create mode 100644 pgserver/config/parameters.go create mode 100644 pgserver/config/parameters_list.go diff --git a/main.go b/main.go index 6514b5c8..95fc6afb 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ import ( "github.com/apecloud/myduckserver/catalog" "github.com/apecloud/myduckserver/myfunc" "github.com/apecloud/myduckserver/pgserver" + "github.com/apecloud/myduckserver/pgserver/config" "github.com/apecloud/myduckserver/pgserver/logrepl" "github.com/apecloud/myduckserver/plugin" "github.com/apecloud/myduckserver/replica" @@ -145,12 +146,12 @@ func main() { replica.RegisterReplicaOptions(&replicaOptions) replica.RegisterReplicaController(provider, engine, pool, builder) - config := server.Config{ + serverConfig := server.Config{ Protocol: "tcp", Address: fmt.Sprintf("%s:%d", address, port), Socket: socket, } - myServer, err := server.NewServerWithHandler(config, engine, backend.NewSessionBuilder(provider, pool), nil, backend.WrapHandler(pool)) + myServer, err := server.NewServerWithHandler(serverConfig, engine, backend.NewSessionBuilder(provider, pool), nil, backend.WrapHandler(pool)) if err != nil { logrus.WithError(err).Fatalln("Failed to create MySQL-protocol server") } @@ -189,6 +190,8 @@ func main() { go replicator.StartReplication(pgServer.NewInternalCtx(), pub) } + // Load the configuration for the Postgres server. + config.Init() go pgServer.Start() } diff --git a/pgserver/config/parameters.go b/pgserver/config/parameters.go new file mode 100644 index 00000000..4f454812 --- /dev/null +++ b/pgserver/config/parameters.go @@ -0,0 +1,273 @@ +// Copyright 2024 Dolthub, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copied from github.com/dolthub/doltgresql/server/config/parameters.go +package config + +import ( + "fmt" + "regexp" + "strings" + "time" + + "gopkg.in/src-d/go-errors.v1" + + "github.com/dolthub/go-mysql-server/sql" + "github.com/dolthub/go-mysql-server/sql/variables" +) + +// doltConfigParameters is a list of Dolt-specific configuration parameters that can be used in SET statement. +var doltConfigParameters = make(map[string]sql.SystemVariable) + +// Init initializes or appends to SystemVariables as it functions as a global variable. +// Currently, we append all of postgres configuration parameters to sql.SystemVariables. +// This means that all of mysql system variables and postgres config parameters will be stored together. +// TODO: get rid of me, use an integration point to define new sysvars +func Init() { + // There are two postgres parameters have the same name as mysql variables + // TODO: issue with this approach is that those parameters will override the mysql variables. + if sql.SystemVariables == nil { + // unlikely this would happen since init() in gms package is executed first + variables.InitSystemVariables() + } + params := make([]sql.SystemVariable, len(postgresConfigParameters)) + i := 0 + for _, sysVar := range postgresConfigParameters { + params[i] = sysVar + i++ + } + sql.SystemVariables.AddSystemVariables(params) +} + +var ( + ErrInvalidValue = errors.NewKind("ERROR: invalid value for parameter \"%s\": \"%s\"") + ErrCannotChangeAtRuntime = errors.NewKind("ERROR: parameter \"%s\" cannot be changed now") +) + +var _ sql.SystemVariable = (*Parameter)(nil) + +type Parameter struct { + Name string + Default any + Category string + ShortDesc string + Context ParameterContext + Type sql.Type + Source ParameterSource + ResetVal any + Scope sql.SystemVariableScope + ValidateFunc func(any) (any, bool) +} + +// GetName implements sql.SystemVariable. +func (p *Parameter) GetName() string { + return p.Name +} + +// GetType implements sql.SystemVariable. +func (p *Parameter) GetType() sql.Type { + return p.Type +} + +// GetSessionScope implements sql.SystemVariable. +func (p *Parameter) GetSessionScope() sql.SystemVariableScope { + return GetPgsqlScope(PsqlScopeSession) +} + +// SetDefault implements sql.SystemVariable. +func (p *Parameter) SetDefault(a any) { + p.Default = a +} + +// GetDefault implements sql.SystemVariable. +func (p *Parameter) GetDefault() any { + return p.Default +} + +// InitValue implements sql.SystemVariable. +func (p *Parameter) InitValue(val any, global bool) (sql.SystemVarValue, error) { + if global { + // This shouldn't happen, but sanity check + return sql.SystemVarValue{}, sql.ErrSystemVariableSessionOnly.New(p.Name) + } + convertedVal, _, err := p.Type.Convert(val) + if err != nil { + return sql.SystemVarValue{}, err + } + if p.ValidateFunc != nil { + v, ok := p.ValidateFunc(convertedVal) + if !ok { + return sql.SystemVarValue{}, ErrInvalidValue.New(p.Name, convertedVal) + } + convertedVal = v + } + svv := sql.SystemVarValue{ + Var: p, + Val: convertedVal, + } + return svv, nil +} + +// SetValue implements sql.SystemVariable. +func (p *Parameter) SetValue(val any, global bool) (sql.SystemVarValue, error) { + if global { + // This shouldn't happen, but sanity check + return sql.SystemVarValue{}, sql.ErrSystemVariableSessionOnly.New(p.Name) + } + if p.IsReadOnly() { + return sql.SystemVarValue{}, ErrCannotChangeAtRuntime.New(p.Name) + } + // TODO: Do parsing of units for memory and time parameters + return p.InitValue(val, global) +} + +// IsReadOnly implements sql.SystemVariable. +func (p *Parameter) IsReadOnly() bool { + switch strings.ToLower(p.Name) { + case "server_version", "server_encoding", "lc_collate", "lc_ctype", "is_superuser": + return true + } + switch p.Context { + case ParameterContextInternal, ParameterContextPostmaster, ParameterContextSighup, + ParameterContextSuperUserBackend, ParameterContextBackend: + // Read the docs above the ParameterContext + // TODO: some of above contexts need support, return error for now + return true + case ParameterContextSuperUser, ParameterContextUser: + // TODO: need to check for 'superuser' and appropriate 'SET' privileges. + // Can be set from `postgresql.conf`, or within a session via the `SET` command. + return false + } + return false +} + +// IsGlobalOnly implements sql.SystemVariable. +func (p *Parameter) IsGlobalOnly() bool { + return false +} + +// DisplayString implements sql.SystemVariable. +func (p *Parameter) DisplayString(_ string) string { + return p.Name +} + +// ParameterContext sets level of difficulty of changing the parameter settings. +// For more detailed description on how to change the settings of specific context, +// https://www.postgresql.org/docs/current/view-pg-settings.html +type ParameterContext string + +// The following constants are in order of decreasing difficulty of changing the setting. +const ( + ParameterContextInternal ParameterContext = "internal" + ParameterContextPostmaster ParameterContext = "postmaster" + ParameterContextSighup ParameterContext = "sighup" + ParameterContextSuperUserBackend ParameterContext = "superuser-backend" + ParameterContextBackend ParameterContext = "backend" + ParameterContextSuperUser ParameterContext = "superuser" + ParameterContextUser ParameterContext = "user" +) + +// ParameterSource sets the source of the current parameter value. +type ParameterSource string + +const ( + ParameterSourceClient ParameterSource = "client" + // ParameterSourceConfigurationFile means that the parameter needs to set + // its Default and ResetVal to what's defined in the given config file. + ParameterSourceConfigurationFile ParameterSource = "configuration file" + ParameterSourceDefault ParameterSource = "default" + // ParameterSourceOverride means the default and reset value needs to be set at server start time + // TODO: currently the default and reset values are dummy values. + ParameterSourceOverride ParameterSource = "override" +) + +var _ sql.SystemVariableScope = (*PgsqlScope)(nil) + +// PgsqlScope represents the scope of a PostgreSQL configuration parameter. +type PgsqlScope struct { + Type PgsqlScopeType +} + +func GetPgsqlScope(t PgsqlScopeType) sql.SystemVariableScope { + return &PgsqlScope{Type: t} +} + +// SetValue implements sql.SystemVariableScope. +func (p *PgsqlScope) SetValue(ctx *sql.Context, name string, val any) error { + switch p.Type { + case PsqlScopeSession: + err := ctx.SetSessionVariable(ctx, name, val) + return err + case PsqlScopeLocal: + // TODO: support LOCAL scope + return fmt.Errorf("unsupported scope `%v` on configuration parameter `%s`", p.Type, name) + default: + return fmt.Errorf("unable to set `%s` due to unknown scope `%v`", name, p.Type) + } +} + +// GetValue implements sql.SystemVariableScope. +func (p *PgsqlScope) GetValue(ctx *sql.Context, name string, _ sql.CollationID) (any, error) { + switch p.Type { + case PsqlScopeSession: + val, err := ctx.GetSessionVariable(ctx, name) + if err != nil { + return nil, err + } + return val, nil + case PsqlScopeLocal: + // TODO: support LOCAL scope + return nil, fmt.Errorf("unsupported scope `%v` on configuration parameter `%s`", p.Type, name) + default: + return nil, fmt.Errorf("unknown scope `%v` on configuration parameter `%s`", p.Type, name) + } +} + +// IsGlobalOnly implements sql.SystemVariableScope. +func (p *PgsqlScope) IsGlobalOnly() bool { + // In Postgres, there is no GLOBAL scope. + return false +} + +// IsSessionOnly implements sql.SystemVariableScope. +func (p *PgsqlScope) IsSessionOnly() bool { + return p.Type == PsqlScopeSession +} + +// PgsqlScopeType represents the scope of a configuration parameter. +type PgsqlScopeType byte + +const ( + // PsqlScopeSession is set when the configuration parameter exists only in the session context. + PsqlScopeSession PgsqlScopeType = iota + // PsqlScopeLocal is set when the configuration parameter exists only in the local context. + PsqlScopeLocal +) + +// tzOffsetRegex is a regex for matching timezone offsets (e.g. +01:00). +var tzOffsetRegex = regexp.MustCompile(`(?m)^([+\-])(\d{2}):(\d{2})$`) + +// TzOffsetToDuration takes in a timezone offset (e.g. "+01:00") and returns it as a time.Duration. +// If any problems are encountered, an error is returned. +func TzOffsetToDuration(d string) (time.Duration, error) { + matches := tzOffsetRegex.FindStringSubmatch(d) + if len(matches) == 4 { + symbol := matches[1] + hours := matches[2] + mins := matches[3] + return time.ParseDuration(symbol + hours + "h" + mins + "m") + } else { + return -1, fmt.Errorf("error: unable to process time") + } +} diff --git a/pgserver/config/parameters_list.go b/pgserver/config/parameters_list.go new file mode 100644 index 00000000..e9bc5d44 --- /dev/null +++ b/pgserver/config/parameters_list.go @@ -0,0 +1,4101 @@ +// Copyright 2024 Dolthub, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Copied from github.com/dolthub/doltgresql/server/config/parameters_list.go +package config + +import ( + "math" + "strings" + "time" + + "github.com/dolthub/go-mysql-server/sql" + "github.com/dolthub/go-mysql-server/sql/types" +) + +// IsValidPostgresConfigParameter returns true if the given parameter name is a valid postgres configuration parameter. +func IsValidPostgresConfigParameter(name string) bool { + _, ok := postgresConfigParameters[strings.ToLower(name)] + return ok +} + +// IsValidDoltConfigParameter returns true if the given parameter name is a valid Dolt configuration parameter. +func IsValidDoltConfigParameter(name string) bool { + _, ok := doltConfigParameters[strings.ToLower(name)] + return ok +} + +// postgresConfigParameters is a list of configuration parameters that can be used in SET statement. +var postgresConfigParameters = map[string]sql.SystemVariable{ + "allow_in_place_tablespaces": &Parameter{ + Name: "allow_in_place_tablespaces", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Allows tablespaces directly inside pg_tblspc, for testing.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("allow_in_place_tablespaces"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "allow_system_table_mods": &Parameter{ + Name: "allow_system_table_mods", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Allows modifications of the structure of system tables.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("allow_system_table_mods"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "application_name": &Parameter{ + Name: "application_name", + Default: "psql", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the application name to be reported in statistics and logs.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("application_name"), + Source: ParameterSourceClient, + ResetVal: "psql", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "archive_cleanup_command": &Parameter{ + Name: "archive_cleanup_command", + Default: "", + Category: "Write-Ahead Log / Archive Recovery", + ShortDesc: "Sets the shell command that will be executed at every restart point.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("archive_cleanup_command"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "archive_command": &Parameter{ + Name: "archive_command", + Default: "(disabled)", + Category: "Write-Ahead Log / Archiving", + ShortDesc: "Sets the shell command that will be called to archive a WAL file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("archive_command"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "archive_library": &Parameter{ + Name: "archive_library", + Default: "", + Category: "Write-Ahead Log / Archiving", + ShortDesc: "Sets the library that will be called to archive a WAL file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("archive_library"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "archive_mode": &Parameter{ + Name: "archive_mode", + Default: "off", + Category: "Write-Ahead Log / Archiving", + ShortDesc: "Allows archiving of WAL files using archive_command.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("archive_mode", "always", "on", "off"), + Source: ParameterSourceDefault, + ResetVal: "off", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "archive_timeout": &Parameter{ + Name: "archive_timeout", + Default: int64(0), + // Unit: "s", + Category: "Write-Ahead Log / Archiving", + ShortDesc: "Sets the amount of time to wait before forcing a switch to the next WAL file.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("archive_timeout", 0, 1073741823, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "array_nulls": &Parameter{ + Name: "array_nulls", + Default: int8(1), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Enable input of NULL elements in arrays.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("array_nulls"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "authentication_timeout": &Parameter{ + Name: "authentication_timeout", + Default: int64(60), + // Unit: "s", + Category: "Connections and Authentication / Authentication", + ShortDesc: "Sets the maximum allowed time to complete client authentication.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("authentication_timeout", 1, 600, false), + Source: ParameterSourceDefault, + ResetVal: int64(60), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum": &Parameter{ + Name: "autovacuum", + Default: int8(1), + Category: "Autovacuum", + ShortDesc: "Starts the autovacuum subprocess.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("autovacuum"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_analyze_scale_factor": &Parameter{ + Name: "autovacuum_analyze_scale_factor", + Default: 0.1, + Category: "Autovacuum", + ShortDesc: "Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("autovacuum_analyze_scale_factor", 0, 100), + Source: ParameterSourceDefault, + ResetVal: 0.1, + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_analyze_threshold": &Parameter{ + Name: "autovacuum_analyze_threshold", + Default: int64(50), + Category: "Autovacuum", + ShortDesc: "Minimum number of tuple inserts, updates, or deletes prior to analyze.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_analyze_threshold", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(50), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_freeze_max_age": &Parameter{ + Name: "autovacuum_freeze_max_age", + Default: int64(2000000000), + Category: "Autovacuum", + ShortDesc: "Age at which to autovacuum a table to prevent transaction ID wraparound.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("autovacuum_freeze_max_age", 100000, 2000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(2000000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_max_workers": &Parameter{ + Name: "autovacuum_max_workers", + Default: int64(3), + Category: "Autovacuum", + ShortDesc: "Sets the maximum number of simultaneously running autovacuum worker processes.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("autovacuum_max_workers", 1, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(3), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_multixact_freeze_max_age": &Parameter{ + Name: "autovacuum_multixact_freeze_max_age", + Default: int64(400000000), + Category: "Autovacuum", + ShortDesc: "Multixact age at which to autovacuum a table to prevent multixact wraparound.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("autovacuum_multixact_freeze_max_age", 10000, 2000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(400000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_naptime": &Parameter{ + Name: "autovacuum_naptime", + Default: int64(60), + // Unit: "s", + Category: "Autovacuum", + ShortDesc: "Time to sleep between autovacuum runs.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_naptime", 1, 2147483, false), + Source: ParameterSourceDefault, + ResetVal: int64(60), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_cost_delay": &Parameter{ + Name: "autovacuum_vacuum_cost_delay", + Default: float64(2), + // Unit: "ms", + Category: "Autovacuum", + ShortDesc: "Vacuum cost delay in milliseconds, for autovacuum.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("autovacuum_vacuum_cost_delay", -1, 100), + Source: ParameterSourceDefault, + ResetVal: float64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_cost_limit": &Parameter{ + Name: "autovacuum_vacuum_cost_limit", + Default: int64(-1), + Category: "Autovacuum", + ShortDesc: "Vacuum cost amount available before napping, for autovacuum.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_vacuum_cost_limit", -1, 10000, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_insert_scale_factor": &Parameter{ + Name: "autovacuum_vacuum_insert_scale_factor", + Default: float64(0.2), + Category: "Autovacuum", + ShortDesc: "Number of tuple inserts prior to vacuum as a fraction of reltuples.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("autovacuum_vacuum_insert_scale_factor", 0, 100), + Source: ParameterSourceDefault, + ResetVal: float64(0.2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_insert_threshold": &Parameter{ + Name: "autovacuum_vacuum_insert_threshold", + Default: int64(1000), + Category: "Autovacuum", + ShortDesc: "SMinimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_vacuum_insert_threshold", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(1000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_scale_factor": &Parameter{ + Name: "autovacuum_vacuum_scale_factor", + Default: float64(0.2), + Category: "Autovacuum", + ShortDesc: "Number of tuple updates or deletes prior to vacuum as a fraction of reltuples.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("autovacuum_vacuum_scale_factor", 0, 100), + Source: ParameterSourceDefault, + ResetVal: float64(0.2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_vacuum_threshold": &Parameter{ + Name: "autovacuum_vacuum_threshold", + Default: int64(50), + Category: "Autovacuum", + ShortDesc: "Minimum number of tuple updates or deletes prior to vacuum.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_vacuum_threshold", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(50), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "autovacuum_work_mem": &Parameter{ + Name: "autovacuum_work_mem", + Default: int64(-1), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum memory to be used by each autovacuum worker process.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("autovacuum_work_mem", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "backend_flush_after": &Parameter{ + Name: "backend_flush_after", + Default: int64(0), + // Unit: "8kB", + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Number of pages after which previously performed writes are flushed to disk.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("backend_flush_after", 0, 256, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "backslash_quote": &Parameter{ + Name: "backslash_quote", + Default: "safe_encoding", + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Sets whether \"\\'\" is allowed in string literals.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("backslash_quote", "safe_encoding", "on", "ff"), + Source: ParameterSourceDefault, + ResetVal: "safe_encoding", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "backtrace_functions": &Parameter{ + Name: "backtrace_functions", + Default: "", + Category: "Developer Options", + ShortDesc: "Log backtrace for errors in these functions.", + Context: ParameterContextSuperUser, + Type: types.NewSystemStringType("backtrace_functions"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bgwriter_delay": &Parameter{ + Name: "bgwriter_delay", + Default: int64(200), + Category: "Resource Usage / Background Writer", + ShortDesc: "Background writer sleep time between rounds.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("bgwriter_delay", 10, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(200), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bgwriter_flush_after": &Parameter{ + Name: "bgwriter_flush_after", + Default: int64(0), + // Unit: "8kB", + Category: "Resource Usage / Background Writer", + ShortDesc: "Number of pages after which previously performed writes are flushed to disk.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("bgwriter_flush_after", 0, 256, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bgwriter_lru_maxpages": &Parameter{ + Name: "bgwriter_lru_maxpages", + Default: int64(100), + Category: "Resource Usage / Background Writer", + ShortDesc: "Background writer maximum number of LRU pages to flush per round.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("bgwriter_lru_maxpages", 0, 1073741823, false), + Source: ParameterSourceDefault, + ResetVal: int64(100), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bgwriter_lru_multiplier": &Parameter{ + Name: "bgwriter_lru_multiplier", + Default: float64(2), + Category: "Resource Usage / Background Writer", + ShortDesc: "Multiple of the average buffer usage to free per round.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("bgwriter_lru_multiplier", 0, 10), + Source: ParameterSourceDefault, + ResetVal: float64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "block_size": &Parameter{ + Name: "block_size", + Default: int64(8192), + Category: "Preset Options", + ShortDesc: "Shows the size of a disk block.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("block_size", 8192, 8192, false), + Source: ParameterSourceDefault, + ResetVal: int64(8192), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bonjour": &Parameter{ + Name: "bonjour", + Default: int8(0), + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Enables advertising the server via Bonjour.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("bonjour"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bonjour_name": &Parameter{ + Name: "bonjour_name", + Default: "", + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the Bonjour service name.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("bonjour_name"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "bytea_output": &Parameter{ + Name: "bytea_output", + Default: "hex", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the output format for bytea.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("bytea_output", "escape", "hex"), + Source: ParameterSourceDefault, + ResetVal: "hex", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "check_function_bodies": &Parameter{ + Name: "check_function_bodies", + Default: int8(1), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("check_function_bodies"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "checkpoint_completion_target": &Parameter{ + Name: "checkpoint_completion_target", + Default: float64(0.9), + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("checkpoint_completion_target", 0, 1), + Source: ParameterSourceDefault, + ResetVal: float64(0.9), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "checkpoint_flush_after": &Parameter{ + Name: "checkpoint_flush_after", + Default: int64(0), + // Unit: "8kB", + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Number of pages after which previously performed writes are flushed to disk.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("checkpoint_flush_after", 0, 256, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "checkpoint_timeout": &Parameter{ + Name: "checkpoint_timeout", + Default: int64(300), + // Unit: "s", + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Sets the maximum time between automatic WAL checkpoints.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("checkpoint_timeout", 30, 86400, false), + Source: ParameterSourceDefault, + ResetVal: int64(300), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "checkpoint_warning": &Parameter{ + Name: "checkpoint_warning", + Default: int64(30), + // Unit: "s", + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Sets the maximum time before warning if checkpoints triggered by WAL volume happen too frequently.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("checkpoint_warning", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(30), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "client_connection_check_interval": &Parameter{ + Name: "client_connection_check_interval", + Default: int64(0), + // Unit: "ms", + Category: "Connections and Authentication / TCP Settings", + ShortDesc: "Sets the time interval between checks for disconnection while running queries.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("client_connection_check_interval", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "client_encoding": &Parameter{ + Name: "client_encoding", + Default: "UTF8", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the client's character set encoding.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("client_encoding"), + Source: ParameterSourceClient, + // BootVal: "SQL_ASCII", + ResetVal: "UTF8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "client_min_messages": &Parameter{ + Name: "client_min_messages", + Default: "notice", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the message levels that are sent to the client.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("client_min_messages", "debug5", "debug4", "debug3", "debug2", "debug1", "log", "notice", "warning", "error"), + Source: ParameterSourceDefault, + ResetVal: "notice", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "cluster_name": &Parameter{ + Name: "cluster_name", + Default: "", + Category: "Reporting and Logging / Process Title", + ShortDesc: "Sets the name of the cluster, which is included in the process title.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("cluster_name"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "commit_delay": &Parameter{ + Name: "commit_delay", + Default: int64(0), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Sets the delay in microseconds between transaction commit and flushing WAL to disk.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("commit_delay", 0, 100000, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "commit_siblings": &Parameter{ + Name: "commit_siblings", + Default: int64(5), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Sets the minimum number of concurrent open transactions required before performing commit_delay.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("commit_siblings", 0, 1000, false), + Source: ParameterSourceDefault, + ResetVal: int64(5), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "compute_query_id": &Parameter{ + Name: "compute_query_id", + Default: "auto", + Category: "Statistics / Monitoring", + ShortDesc: "Enables in-core computation of query identifiers.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("compute_query_id", "auto", "regress", "on", "off"), + Source: ParameterSourceDefault, + ResetVal: "auto", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "config_file": &Parameter{ + Name: "config_file", + Default: "postgresql.conf", + Category: "File Locations", + ShortDesc: "Sets the server's main configuration file.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("config_file"), + Source: ParameterSourceOverride, + ResetVal: "postgresql.conf", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "constraint_exclusion": &Parameter{ + Name: "constraint_exclusion", + Default: "partition", + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Enables the planner to use constraints to optimize queries.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("constraint_exclusion", "partition", "on", "off"), + Source: ParameterSourceDefault, + ResetVal: "partition", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "cpu_index_tuple_cost": &Parameter{ + Name: "cpu_index_tuple_cost", + Default: float64(0.005), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of processing each index entry during an index scan.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("cpu_index_tuple_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(0.005), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "cpu_operator_cost": &Parameter{ + Name: "cpu_operator_cost", + Default: float64(0.0025), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of processing each operator or function call.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("cpu_operator_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(0.0025), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "cpu_tuple_cost": &Parameter{ + Name: "cpu_tuple_cost", + Default: float64(0.01), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of processing each tuple (row).", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("cpu_tuple_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(0.01), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "createrole_self_grant": &Parameter{ + Name: "createrole_self_grant", + Default: "", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets whether a CREATEROLE user automatically grants the role to themselves, and with which options.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("createrole_self_grant"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + // The value must be `set`, `inherit`, or a comma-separated list of these. The default value is an empty string, which disables the feature. + }, + "cursor_tuple_fraction": &Parameter{ + Name: "cursor_tuple_fraction", + Default: float64(0.1), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Sets the planner's estimate of the fraction of a cursor's rows that will be retrieved.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("cursor_tuple_fraction", 0, 1), + Source: ParameterSourceDefault, + ResetVal: float64(0.1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "data_checksums": &Parameter{ + Name: "data_checksums", + Default: int8(0), + Category: "Preset Options", + ShortDesc: "Shows whether data checksums are turned on for this cluster.", + Context: ParameterContextInternal, + Type: types.NewSystemBoolType("data_checksums"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "data_directory": &Parameter{ + Name: "data_directory", + Default: "postgres", + Category: "File Locations", + ShortDesc: "Sets the server's data directory.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("data_directory"), + Source: ParameterSourceOverride, + ResetVal: "postgres", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "data_directory_mode": &Parameter{ + Name: "data_directory_mode", + Default: int64(448), // TODO: displays in octal, which is 0700 + Category: "Preset Options", + ShortDesc: "Shows the mode of the data directory.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("data_directory_mode", 0, 511, false), + Source: ParameterSourceDefault, + ResetVal: int64(448), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "data_sync_retry": &Parameter{ + Name: "data_sync_retry", + Default: int8(0), + Category: "Error Handling", + ShortDesc: "Whether to continue running after a failure to sync data files.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("data_sync_retry"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "datestyle": &Parameter{ + Name: "DateStyle", + Default: "ISO, MDY", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the display format for date and time values.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("datestyle"), + Source: ParameterSourceConfigurationFile, + ResetVal: "ISO, MDY", + // Sourcefile: postgresql.conf + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "db_user_namespace": &Parameter{ + Name: "db_user_namespace", + Default: int8(0), + Category: "Connections and Authentication / Authentication", + ShortDesc: "Enables per-database user names.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("db_user_namespace"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "deadlock_timeout": &Parameter{ + Name: "deadlock_timeout", + Default: int64(1000), + // Unit: "ms", + Category: "Lock Management", + ShortDesc: "Sets the time to wait on a lock before checking for deadlock.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("deadlock_timeout", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(1000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_assertions": &Parameter{ + Name: "debug_assertions", + Default: int8(0), + Category: "Preset Options", + ShortDesc: "Shows whether the running server has assertion checks enabled.", + Context: ParameterContextInternal, + Type: types.NewSystemBoolType("debug_assertions"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_discard_caches": &Parameter{ + Name: "debug_discard_caches", + Default: int64(0), + Category: "Developer Options", + ShortDesc: "Aggressively flush system caches for debugging purposes.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("debug_discard_caches", 0, 0, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_io_direct": &Parameter{ + Name: "debug_io_direct", + Default: "", + Category: "Developer Options", + ShortDesc: "Use direct I/O for file access.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("debug_io_direct"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_logical_replication_streaming": &Parameter{ + Name: "debug_logical_replication_streaming", + Default: "buffered", + Category: "Developer Options", + ShortDesc: "Forces immediate streaming or serialization of changes in large transactions.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("debug_logical_replication_streaming", "buffered", "immediate"), + Source: ParameterSourceDefault, + ResetVal: "buffered", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_parallel_query": &Parameter{ + Name: "debug_parallel_query", + Default: "off", + Category: "Developer Options", + ShortDesc: "Forces the planner's use parallel query nodes.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("debug_parallel_query", "off", "on", "regress"), + Source: ParameterSourceDefault, + ResetVal: "off", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_pretty_print": &Parameter{ + Name: "debug_pretty_print", + Default: int8(1), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Indents parse and plan tree displays.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("debug_pretty_print"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_print_parse": &Parameter{ + Name: "debug_print_parse", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs each query's parse tree.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("debug_print_parse"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_print_plan": &Parameter{ + Name: "debug_print_plan", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the shell command that will be executed at every restart point.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("debug_print_plan"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "debug_print_rewritten": &Parameter{ + Name: "debug_print_rewritten", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs each query's rewritten parse tree.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("debug_print_rewritten"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_statistics_target": &Parameter{ + Name: "default_statistics_target", + Default: int64(100), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Sets the default statistics target.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("default_statistics_target", 1, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(100), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_table_access_method": &Parameter{ + Name: "default_table_access_method", + Default: "heap", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the default table access method for new tables.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("default_table_access_method"), + Source: ParameterSourceDefault, + ResetVal: "heap", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_tablespace": &Parameter{ + Name: "default_tablespace", + Default: "", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the default tablespace to create tables and indexes in.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("default_tablespace"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_text_search_config": &Parameter{ + Name: "default_text_search_config", + Default: "pg_catalog.english", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets default text search configuration.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("default_text_search_config"), + Source: ParameterSourceConfigurationFile, + // BootVal: "pg_catalog.simple", + ResetVal: "pg_catalog.english", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_toast_compression": &Parameter{ + Name: "default_toast_compression", + Default: "pglz", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the default compression method for compressible values.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("default_toast_compression", "pglz", "lz4"), + Source: ParameterSourceDefault, + ResetVal: "pglz", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_transaction_deferrable": &Parameter{ + Name: "default_transaction_deferrable", + Default: int8(0), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the default deferrable status of new transactions.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("default_transaction_deferrable"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_transaction_isolation": &Parameter{ + Name: "default_transaction_isolation", + Default: "read committed", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the transaction isolation level of each new transaction.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("default_transaction_isolation", "serializable", "repeatable read", "read committed", "read uncommitted"), + Source: ParameterSourceDefault, + ResetVal: "read committed", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "default_transaction_read_only": &Parameter{ + Name: "default_transaction_read_only", + Default: int8(0), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the default read-only status of new transactions.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("default_transaction_read_only"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "dynamic_library_path": &Parameter{ + Name: "dynamic_library_path", + Default: "$libdir", + Category: "Client Connection Defaults / Other Defaults", + ShortDesc: "Sets the path for dynamically loadable modules.", + Context: ParameterContextSuperUser, + Type: types.NewSystemStringType("dynamic_library_path"), + Source: ParameterSourceDefault, + ResetVal: "$libdir", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "dynamic_shared_memory_type": &Parameter{ + Name: "dynamic_shared_memory_type", + Default: "posix", + Category: "Resource Usage / Memory", + ShortDesc: "Selects the dynamic shared memory implementation used.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("dynamic_shared_memory_type", "posix", "sysv", "mmap"), + Source: ParameterSourceConfigurationFile, + ResetVal: "posix", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "effective_cache_size": &Parameter{ + Name: "effective_cache_size", + Default: int64(524288), + // Unit: "8kB", + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's assumption about the total size of the data caches.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("effective_cache_size", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(524288), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "effective_io_concurrency": &Parameter{ + Name: "effective_io_concurrency", + Default: int64(0), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Number of simultaneous requests that can be handled efficiently by the disk subsystem.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("effective_io_concurrency", 0, 1000, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_async_append": &Parameter{ + Name: "enable_async_append", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of async append plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_async_append"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_bitmapscan": &Parameter{ + Name: "enable_bitmapscan", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of bitmap-scan plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_bitmapscan"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_gathermerge": &Parameter{ + Name: "enable_gathermerge", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of gather merge plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_gathermerge"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_hashagg": &Parameter{ + Name: "enable_hashagg", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of hashed aggregation plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_hashagg"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_hashjoin": &Parameter{ + Name: "enable_hashjoin", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of hash join plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_hashjoin"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_incremental_sort": &Parameter{ + Name: "enable_incremental_sort", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of incremental sort steps.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_incremental_sort"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_indexonlyscan": &Parameter{ + Name: "enable_indexonlyscan", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of index-only-scan plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_indexonlyscan"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_indexscan": &Parameter{ + Name: "enable_indexscan", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of index-scan plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_indexscan"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_material": &Parameter{ + Name: "enable_material", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of materialization.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_material"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_memoize": &Parameter{ + Name: "enable_memoize", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of memoization.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_memoize"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_mergejoin": &Parameter{ + Name: "enable_mergejoin", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of merge join plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_mergejoin"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_nestloop": &Parameter{ + Name: "enable_nestloop", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of nested-loop join plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_nestloop"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_parallel_append": &Parameter{ + Name: "enable_parallel_append", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of parallel append plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_parallel_append"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_parallel_hash": &Parameter{ + Name: "enable_parallel_hash", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of parallel hash plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_parallel_hash"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_partition_pruning": &Parameter{ + Name: "enable_partition_pruning", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables plan-time and execution-time partition pruning.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_partition_pruning"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_partitionwise_aggregate": &Parameter{ + Name: "enable_partitionwise_aggregate", + Default: int8(0), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables partitionwise aggregation and grouping.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_partitionwise_aggregate"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_partitionwise_join": &Parameter{ + Name: "enable_partitionwise_join", + Default: int8(0), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables partitionwise join.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_partitionwise_join"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_presorted_aggregate": &Parameter{ + Name: "enable_presorted_aggregate", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's ability to produce plans that provide presorted input for ORDER BY / DISTINCT aggregate functions.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_presorted_aggregate"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_seqscan": &Parameter{ + Name: "enable_seqscan", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of sequential-scan plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_seqscan"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_sort": &Parameter{ + Name: "enable_sort", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of explicit sort steps.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_sort"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "enable_tidscan": &Parameter{ + Name: "enable_tidscan", + Default: int8(1), + Category: "Query Tuning / Planner Method Configuration", + ShortDesc: "Enables the planner's use of TID scan plans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("enable_tidscan"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "escape_string_warning": &Parameter{ + Name: "escape_string_warning", + Default: int8(1), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Warn about backslash escapes in ordinary string literals.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("escape_string_warning"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "event_source": &Parameter{ + Name: "event_source", + Default: "PostgreSQL", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the application name used to identify PostgreSQL messages in the event log.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("event_source"), + Source: ParameterSourceDefault, + ResetVal: "PostgreSQL", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "exit_on_error": &Parameter{ + Name: "exit_on_error", + Default: int8(0), + Category: "Error Handling", + ShortDesc: "Terminate session on any error.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("exit_on_error"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "external_pid_file": &Parameter{ + Name: "external_pid_file", + Default: "", + Category: "File Locations", + ShortDesc: "Writes the postmaster PID to the specified file.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("external_pid_file"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "extra_float_digits": &Parameter{ + Name: "extra_float_digits", + Default: int64(1), + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the number of digits displayed for floating-point values.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("extra_float_digits", -15, 3, false), + Source: ParameterSourceDefault, + ResetVal: int64(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "from_collapse_limit": &Parameter{ + Name: "from_collapse_limit", + Default: int64(8), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Sets the FROM-list size beyond which subqueries are not collapsed.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("from_collapse_limit", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(8), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "fsync": &Parameter{ + Name: "fsync", + Default: int8(1), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Forces synchronization of updates to disk.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("fsync"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "full_page_writes": &Parameter{ + Name: "full_page_writes", + Default: int8(1), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Writes full pages to WAL when first modified after a checkpoint.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("full_page_writes"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo": &Parameter{ + Name: "geqo", + Default: int8(1), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "Enables genetic query optimization.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("geqo"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_effort": &Parameter{ + Name: "geqo_effort", + Default: int64(5), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "GEQO: effort is used to set the default for other GEQO parameters.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("geqo_effort", 1, 10, false), + Source: ParameterSourceDefault, + ResetVal: int64(5), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_generations": &Parameter{ + Name: "geqo_generations", + Default: int64(0), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "GEQO: number of iterations of the algorithm.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("geqo_generations", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_pool_size": &Parameter{ + Name: "geqo_pool_size", + Default: int64(0), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "GEQO: number of individuals in the population.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("geqo_pool_size", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_seed": &Parameter{ + Name: "geqo_seed", + Default: float64(0), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "GEQO: seed for random path selection.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("geqo_seed", 0, 1), + Source: ParameterSourceDefault, + ResetVal: float64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_selection_bias": &Parameter{ + Name: "geqo_selection_bias", + Default: float64(2), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "GEQO: selective pressure within the population.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("geqo_selection_bias", 1.5, 2), + Source: ParameterSourceDefault, + ResetVal: float64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "geqo_threshold": &Parameter{ + Name: "geqo_threshold", + Default: int64(12), + Category: "Query Tuning / Genetic Query Optimizer", + ShortDesc: "Sets the shell command that will be executed at every restart point.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("geqo_threshold", 2, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(12), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "gin_fuzzy_search_limit": &Parameter{ + Name: "gin_fuzzy_search_limit", + Default: int64(0), + Category: "Client Connection Defaults / Other Defaults", + ShortDesc: "Sets the maximum allowed result for exact search by GIN.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("gin_fuzzy_search_limit", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "gin_pending_list_limit": &Parameter{ + Name: "gin_pending_list_limit", + Default: int64(4096), + // Unit: "kB", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the maximum size of the pending list for GIN index.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("gin_pending_list_limit", 64, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(4096), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "gss_accept_delegation": &Parameter{ + Name: "gss_accept_delegation", + Default: int8(0), + Category: "Connections and Authentication / Authentication", + ShortDesc: "Sets whether GSSAPI delegation should be accepted from the client.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("gss_accept_delegation"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "hash_mem_multiplier": &Parameter{ + Name: "hash_mem_multiplier", + Default: float64(2), + Category: "Resource Usage / Memory", + ShortDesc: "Multiple of work_mem to use for hash tables.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("hash_mem_multiplier", 1, 1000), + Source: ParameterSourceDefault, + ResetVal: float64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "hba_file": &Parameter{ + Name: "hba_file", + Default: "pg_hba.conf", + Category: "File Locations", + ShortDesc: "Sets the server's \"hba\" configuration file.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("hba_file"), + Source: ParameterSourceOverride, + ResetVal: "pg_hba.conf", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "hot_standby": &Parameter{ + Name: "hot_standby", + Default: int8(1), + Category: "Replication / Standby Servers", + ShortDesc: "Allows connections and queries during recovery.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("hot_standby"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "hot_standby_feedback": &Parameter{ + Name: "hot_standby_feedback", + Default: int8(0), + Category: "Replication / Standby Servers", + ShortDesc: "Allows feedback from a hot standby to the primary that will avoid query conflicts.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("hot_standby_feedback"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "huge_page_size": &Parameter{ + Name: "huge_page_size", + Default: int64(0), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "The size of huge page that should be requested.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("huge_page_size", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "huge_pages": &Parameter{ + Name: "huge_pages", + Default: "try", + Category: "Resource Usage / Memory", + ShortDesc: "Use of huge pages on Linux or Windows.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("huge_pages", "off", "on", "try"), + Source: ParameterSourceDefault, + ResetVal: "try", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "icu_validation_level": &Parameter{ + Name: "icu_validation_level", + Default: "warning", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Log level for reporting invalid ICU locale strings.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("icu_validation_level", "disabled", "debug5", "debug4", "debug3", "debug2", "debug1", "log", "notice", "warning", "error"), + Source: ParameterSourceDefault, + ResetVal: "warning", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ident_file": &Parameter{ + Name: "ident_file", + Default: "pg_ident.conf", + Category: "File Locations", + ShortDesc: "Sets the server's \"ident\" configuration file.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("ident_file"), + Source: ParameterSourceOverride, + ResetVal: "pg_ident.conf", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "idle_in_transaction_session_timeout": &Parameter{ + Name: "idle_in_transaction_session_timeout", + Default: int64(0), + // Unit: "ms", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the maximum allowed idle time between queries, when in a transaction.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("idle_in_transaction_session_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "idle_session_timeout": &Parameter{ + Name: "idle_session_timeout", + Default: int64(0), + // Unit: "ms", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the maximum allowed idle time between queries, when not in a transaction.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("idle_session_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ignore_checksum_failure": &Parameter{ + Name: "ignore_checksum_failure", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Continues processing after a checksum failure.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("ignore_checksum_failure"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ignore_invalid_pages": &Parameter{ + Name: "ignore_invalid_pages", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Continues recovery after an invalid pages failure.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("ignore_invalid_pages"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ignore_system_indexes": &Parameter{ + Name: "ignore_system_indexes", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Disables reading from system indexes.", + Context: ParameterContextBackend, + Type: types.NewSystemBoolType("ignore_system_indexes"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "in_hot_standby": &Parameter{ + Name: "in_hot_standby", + Default: int8(0), + Category: "Preset Options", + ShortDesc: "Shows whether hot standby is currently active.", + Context: ParameterContextInternal, + Type: types.NewSystemBoolType("in_hot_standby"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "integer_datetimes": &Parameter{ + Name: "integer_datetimes", + Default: int8(1), + Category: "Preset Options", + ShortDesc: "Shows whether datetimes are integer based.", + Context: ParameterContextInternal, + Type: types.NewSystemBoolType("integer_datetimes"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "intervalstyle": &Parameter{ + Name: "IntervalStyle", + Default: "postgres", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the display format for interval values.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("intervalstyle", "postgres", "postgres_verbose", "sql_standard", "iso_8601"), + Source: ParameterSourceDefault, + ResetVal: "postgres", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit": &Parameter{ + Name: "jit", + Default: int8(1), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Allow JIT compilation.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("jit"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_above_cost": &Parameter{ + Name: "jit_above_cost", + Default: float64(100000), + Category: "Write-Ahead Log / Archive Recovery", + ShortDesc: "Sets the shell command that will be executed at every restart point.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("jit_above_cost", -1, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(100000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_debugging_support": &Parameter{ + Name: "jit_debugging_support", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Register JIT-compiled functions with debugger.", + Context: ParameterContextSuperUserBackend, + Type: types.NewSystemBoolType("jit_debugging_support"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_dump_bitcode": &Parameter{ + Name: "jit_dump_bitcode", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Write out LLVM bitcode to facilitate JIT debugging.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("jit_dump_bitcode"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_expressions": &Parameter{ + Name: "jit_expressions", + Default: int8(1), + Category: "Developer Options", + ShortDesc: "Allow JIT compilation of expressions.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("jit_expressions"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_inline_above_cost": &Parameter{ + Name: "jit_inline_above_cost", + Default: float64(500000), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Perform JIT inlining if query is more expensive.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("jit_inline_above_cost", -1, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(500000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_optimize_above_cost": &Parameter{ + Name: "jit_optimize_above_cost", + Default: float64(500000), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Optimize JIT-compiled functions if query is more expensive.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("jit_optimize_above_cost", -1, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(500000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_profiling_support": &Parameter{ + Name: "jit_profiling_support", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Register JIT-compiled functions with perf profiler.", + Context: ParameterContextSuperUserBackend, + Type: types.NewSystemBoolType("jit_profiling_support"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_provider": &Parameter{ + Name: "jit_provider", + Default: "llvmjit", + Category: "Client Connection Defaults / Shared Library Preloading", + ShortDesc: "JIT provider to use.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("jit_provider"), + Source: ParameterSourceDefault, + ResetVal: "llvmjit", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "jit_tuple_deforming": &Parameter{ + Name: "jit_tuple_deforming", + Default: int8(1), + Category: "Developer Options", + ShortDesc: "Allow JIT compilation of tuple deforming.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("jit_tuple_deforming"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "join_collapse_limit": &Parameter{ + Name: "join_collapse_limit", + Default: int64(8), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Sets the FROM-list size beyond which JOIN constructs are not flattened.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("join_collapse_limit", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(8), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "krb_caseins_users": &Parameter{ + Name: "krb_caseins_users", + Default: int8(0), + Category: "Connections and Authentication / Authentication", + ShortDesc: "Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("krb_caseins_users"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "krb_server_keyfile": &Parameter{ + Name: "krb_server_keyfile", + Default: "FILE:/usr/local/etc/postgresql/krb5.keytab", + Category: "Connections and Authentication / Authentication", + ShortDesc: "Sets the location of the Kerberos server key file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("krb_server_keyfile"), + Source: ParameterSourceDefault, + ResetVal: "FILE:/usr/local/etc/postgresql/krb5.keytab", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lc_messages": &Parameter{ + Name: "lc_messages", + Default: "en_US.UTF-8", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the language in which messages are displayed.", + Context: ParameterContextSuperUser, + Type: types.NewSystemStringType("lc_messages"), + Source: ParameterSourceConfigurationFile, + ResetVal: "en_US.UTF-8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lc_monetary": &Parameter{ + Name: "lc_monetary", + Default: "en_US.UTF-8", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the locale for formatting monetary amounts.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("lc_monetary"), + Source: ParameterSourceConfigurationFile, + // BootVal: "C", + ResetVal: "en_US.UTF-8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lc_numeric": &Parameter{ + Name: "lc_numeric", + Default: "en_US.UTF-8", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the locale for formatting numbers.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("lc_numeric"), + Source: ParameterSourceConfigurationFile, + // BootVal: "C", + ResetVal: "en_US.UTF-8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lc_time": &Parameter{ + Name: "lc_time", + Default: "en_US.UTF-8", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the locale for formatting date and time values.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("lc_time"), + Source: ParameterSourceConfigurationFile, + // BootVal: "C", + ResetVal: "en_US.UTF-8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "listen_addresses": &Parameter{ + Name: "listen_addresses", + Default: "localhost", + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the host name or IP address(es) to listen to.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("listen_addresses"), + Source: ParameterSourceDefault, + ResetVal: "localhost", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lo_compat_privileges": &Parameter{ + Name: "lo_compat_privileges", + Default: int8(0), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Enables backward compatibility mode for privilege checks on large objects.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("lo_compat_privileges"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "local_preload_libraries": &Parameter{ + Name: "local_preload_libraries", + Default: "", + Category: "Client Connection Defaults / Shared Library Preloading", + ShortDesc: "Lists unprivileged shared libraries to preload into each backend.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("local_preload_libraries"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "lock_timeout": &Parameter{ + Name: "lock_timeout", + Default: int64(0), + // Unit: "ms", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the maximum allowed duration of any wait for a lock.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("lock_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_autovacuum_min_duration": &Parameter{ + Name: "log_autovacuum_min_duration", + Default: int64(-1), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the minimum execution time above which autovacuum actions will be logged.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("log_autovacuum_min_duration", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_checkpoints": &Parameter{ + Name: "log_checkpoints", + Default: int8(1), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs each checkpoint.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("log_checkpoints"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_connections": &Parameter{ + Name: "log_connections", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs each successful connection.", + Context: ParameterContextSuperUserBackend, + Type: types.NewSystemBoolType("log_connections"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_destination": &Parameter{ + Name: "log_destination", + Default: "stderr", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the destination for server log output.", + // LongDesc: "Valid values are combinations of "stderr", "syslog", "csvlog", "jsonlog", and "eventlog", depending on the platform.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("log_destination"), + Source: ParameterSourceDefault, + ResetVal: "stderr", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_directory": &Parameter{ + Name: "log_directory", + Default: "log", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the destination directory for log files.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("log_directory"), + Source: ParameterSourceDefault, + ResetVal: "log", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_disconnections": &Parameter{ + Name: "log_disconnections", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs end of a session, including duration.", + Context: ParameterContextSuperUserBackend, + Type: types.NewSystemBoolType("log_disconnections"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_duration": &Parameter{ + Name: "log_duration", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs the duration of each completed SQL statement.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_duration"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_error_verbosity": &Parameter{ + Name: "log_error_verbosity", + Default: "default", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the verbosity of logged messages.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("log_error_verbosity", "terse", "default", "verbose"), + Source: ParameterSourceDefault, + ResetVal: "default", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_executor_stats": &Parameter{ + Name: "log_executor_stats", + Default: int8(0), + Category: "Statistics / Monitoring", + ShortDesc: "Writes executor performance statistics to the server log.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_executor_stats"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_file_mode": &Parameter{ + Name: "log_file_mode", + Default: int64(384), // displays in octal, which is 0600 + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the file permissions for log files.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("log_file_mode", 0, 511, false), + Source: ParameterSourceDefault, + ResetVal: int64(384), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_filename": &Parameter{ + Name: "log_filename", + Default: "postgresql-%Y-%m-%d_%H%M%S.log", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the file name pattern for log files.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("log_filename"), + Source: ParameterSourceDefault, + ResetVal: "postgresql-%Y-%m-%d_%H%M%S.log", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_hostname": &Parameter{ + Name: "log_hostname", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs the host name in the connection logs.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("log_hostname"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_line_prefix": &Parameter{ + Name: "log_line_prefix", + Default: "%m [%p]", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Controls information prefixed to each log line.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("log_line_prefix"), + Source: ParameterSourceDefault, + ResetVal: "%m [%p]", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_lock_waits": &Parameter{ + Name: "log_lock_waits", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs long lock waits.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_lock_waits"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_min_duration_sample": &Parameter{ + Name: "log_min_duration_sample", + Default: int64(-1), + // Unit: "ms", + Category: "Reporting and Logging / When to Log", + ShortDesc: "Sets the minimum execution time above which a sample of statements will be logged. Sampling is determined by log_statement_sample_rate.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("log_min_duration_sample", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_min_duration_statement": &Parameter{ + Name: "log_min_duration_statement", + Default: int64(-1), + // Unit: "ms", + Category: "Reporting and Logging / When to Log", + ShortDesc: "Sets the minimum execution time above which all statements will be logged.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("log_min_duration_statement", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_min_error_statement": &Parameter{ + Name: "log_min_error_statement", + Default: "error", + Category: "Reporting and Logging / When to Log", + ShortDesc: "Causes all statements generating error at or above this level to be logged.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("log_min_error_statement", "debug5", "debug4", "debug3", "debug2", "debug1", "info", "notice", "warning", "error", "log", "fatal", "panic"), + Source: ParameterSourceDefault, + ResetVal: "error", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_min_messages": &Parameter{ + Name: "log_min_messages", + Default: "warning", + Category: "Reporting and Logging / When to Log", + ShortDesc: "Sets the message levels that are logged.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("log_min_messages", "debug5", "debug4", "debug3", "debug2", "debug1", "info", "notice", "warning", "error", "log", "fatal", "panic"), + Source: ParameterSourceDefault, + ResetVal: "warning", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_parameter_max_length": &Parameter{ + Name: "log_parameter_max_length", + Default: int64(-1), + // Unit: "B", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the maximum length in bytes of data logged for bind parameter values when logging statements.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("log_parameter_max_length", -1, 1073741823, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_parameter_max_length_on_error": &Parameter{ + Name: "log_parameter_max_length_on_error", + Default: int64(0), + // Unit: "B", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the maximum length in bytes of data logged for bind parameter values when logging statements, on error.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("log_parameter_max_length_on_error", -1, 1073741823, true), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_parser_stats": &Parameter{ + Name: "log_parser_stats", + Default: int8(0), + Category: "Statistics / Monitoring", + ShortDesc: "Writes parser performance statistics to the server log.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_parser_stats"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_planner_stats": &Parameter{ + Name: "log_planner_stats", + Default: int8(0), + Category: "Statistics / Monitoring", + ShortDesc: "Writes planner performance statistics to the server log.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_planner_stats"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_recovery_conflict_waits": &Parameter{ + Name: "log_recovery_conflict_waits", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs standby recovery conflict waits.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("log_recovery_conflict_waits"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_replication_commands": &Parameter{ + Name: "log_replication_commands", + Default: int8(0), + Category: "Reporting and Logging / What to Log", + ShortDesc: "Logs each replication command.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_replication_commands"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_rotation_age": &Parameter{ + Name: "log_rotation_age", + Default: int64(1440), + // Unit: "min", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the amount of time to wait before forcing log file rotation.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("log_rotation_age", 0, 35791394, false), + Source: ParameterSourceDefault, + ResetVal: int64(1440), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_rotation_size": &Parameter{ + Name: "log_rotation_size", + Default: int64(10240), + // Unit: "kB", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the maximum size a log file can reach before being rotated.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("log_rotation_size", 0, 2097151, false), + Source: ParameterSourceDefault, + ResetVal: int64(10240), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_startup_progress_interval": &Parameter{ + Name: "log_startup_progress_interval", + Default: int64(10000), + Category: "Reporting and Logging / When to Log", + ShortDesc: "Time between progress updates for long-running startup operations.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("log_startup_progress_interval", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(10000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_statement": &Parameter{ + Name: "log_statement", + Default: "none", + Category: "Reporting and Logging / When to Log", + ShortDesc: "Sets the type of statements logged.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("log_statement", "none", "ddl", "mod", "all"), + Source: ParameterSourceDefault, + ResetVal: "none", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_statement_sample_rate": &Parameter{ + Name: "log_statement_sample_rate", + Default: float64(1), + Category: "Reporting and Logging / When to Log", + ShortDesc: "Fraction of statements exceeding log_min_duration_sample to be logged.", + Context: ParameterContextSuperUser, + Type: types.NewSystemDoubleType("log_statement_sample_rate", 0, 1), + Source: ParameterSourceDefault, + ResetVal: float64(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_statement_stats": &Parameter{ + Name: "log_statement_stats", + Default: int8(0), + Category: "Statistics / Monitoring", + ShortDesc: "Writes cumulative performance statistics to the server log.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("log_statement_stats"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_temp_files": &Parameter{ + Name: "log_temp_files", + Default: int64(-1), + // Unit: "kB", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Log the use of temporary files larger than this number of kilobytes.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("log_temp_files", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_timezone": &Parameter{ + Name: "log_timezone", + Default: "America/Los_Angeles", + Category: "Reporting and Logging / What to Log", + ShortDesc: "Sets the time zone to use in log messages.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("log_timezone"), + Source: ParameterSourceConfigurationFile, + // BootVal: "GMT", + ResetVal: "America/Los_Angeles", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_transaction_sample_rate": &Parameter{ + Name: "log_transaction_sample_rate", + Default: float64(0), + Category: "Reporting and Logging / When to Log", + ShortDesc: "Sets the fraction of transactions from which to log all statements.", + Context: ParameterContextSuperUser, + Type: types.NewSystemDoubleType("log_transaction_sample_rate", 0, 1), + Source: ParameterSourceDefault, + ResetVal: float64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "log_truncate_on_rotation": &Parameter{ + Name: "log_truncate_on_rotation", + Default: int8(0), + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Truncate existing log files of same name during log rotation.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("log_truncate_on_rotation"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "logging_collector": &Parameter{ + Name: "logging_collector", + Default: int8(0), + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Start a subprocess to capture stderr output and/or csvlogs into log files.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("logging_collector"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "logical_decoding_work_mem": &Parameter{ + Name: "logical_decoding_work_mem", + Default: int64(65536), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum memory to be used for logical decoding.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("logical_decoding_work_mem", 64, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(65536), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "maintenance_io_concurrency": &Parameter{ + Name: "maintenance_io_concurrency", + Default: int64(0), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "A variant of effective_io_concurrency that is used for maintenance work.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("maintenance_io_concurrency", 0, 1000, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "maintenance_work_mem": &Parameter{ + Name: "maintenance_work_mem", + Default: int64(65536), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum memory to be used for maintenance operations.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("maintenance_work_mem", 1024, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(65536), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_connections": &Parameter{ + Name: "max_connections", + Default: int64(100), + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the maximum number of concurrent connections.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_connections", 64, math.MaxInt32, false), + Source: ParameterSourceConfigurationFile, + ResetVal: int64(100), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_files_per_process": &Parameter{ + Name: "max_files_per_process", + Default: int64(1000), + Category: "Resource Usage / Kernel Resources", + ShortDesc: "Sets the maximum number of simultaneously open files for each server process.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_files_per_process", 64, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(1000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_function_args": &Parameter{ + Name: "max_function_args", + Default: int64(100), + Category: "Preset Options", + ShortDesc: "Shows the maximum number of function arguments.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("max_function_args", 100, 100, false), + Source: ParameterSourceDefault, + ResetVal: int64(100), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_identifier_length": &Parameter{ + Name: "max_identifier_length", + Default: int64(63), + Category: "Preset Options", + ShortDesc: "Shows the maximum identifier length.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("max_identifier_length", 63, 63, false), + Source: ParameterSourceDefault, + ResetVal: int64(63), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_index_keys": &Parameter{ + Name: "max_index_keys", + Default: int64(32), + Category: "Preset Options", + ShortDesc: "Shows the maximum number of index keys.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("max_index_keys", 32, 32, false), + Source: ParameterSourceDefault, + ResetVal: int64(32), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_locks_per_transaction": &Parameter{ + Name: "max_locks_per_transaction", + Default: int64(64), + Category: "Lock Management", + ShortDesc: "Sets the maximum number of locks per transaction.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_locks_per_transaction", 10, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(64), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_logical_replication_workers": &Parameter{ + Name: "max_logical_replication_workers", + Default: int64(4), + Category: "Replication / Subscribers", + ShortDesc: "Maximum number of logical replication worker processes.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_logical_replication_workers", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(4), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_parallel_apply_workers_per_subscription": &Parameter{ + Name: "max_parallel_apply_workers_per_subscription", + Default: int64(2), + Category: "Replication / Subscribers", + ShortDesc: "Maximum number of parallel apply workers per subscription.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_parallel_apply_workers_per_subscription", 0, 1024, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_parallel_maintenance_workers": &Parameter{ + Name: "max_parallel_maintenance_workers", + Default: int64(2), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Sets the maximum number of parallel processes per maintenance operation.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("max_parallel_maintenance_workers", 0, 1024, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_parallel_workers": &Parameter{ + Name: "max_parallel_workers", + Default: int64(8), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Sets the maximum number of parallel workers that can be active at one time.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("max_parallel_workers", 0, 1024, false), + Source: ParameterSourceDefault, + ResetVal: int64(8), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_parallel_workers_per_gather": &Parameter{ + Name: "max_parallel_workers_per_gather", + Default: int64(2), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Sets the maximum number of parallel processes per executor node.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("max_parallel_workers_per_gather", 0, 1024, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_pred_locks_per_page": &Parameter{ + Name: "max_pred_locks_per_page", + Default: int64(2), + Category: "Lock Management", + ShortDesc: "Sets the maximum number of predicate-locked tuples per page.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_pred_locks_per_page", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_pred_locks_per_relation": &Parameter{ + Name: "max_pred_locks_per_relation", + Default: int64(-2), + Category: "Lock Management", + ShortDesc: "Sets the maximum number of predicate-locked pages and tuples per relation.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_pred_locks_per_relation", math.MinInt32, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(-2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_pred_locks_per_transaction": &Parameter{ + Name: "max_pred_locks_per_transaction", + Default: int64(64), + Category: "Lock Management", + ShortDesc: "Sets the maximum number of predicate locks per transaction.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_pred_locks_per_transaction", 10, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(64), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_prepared_transactions": &Parameter{ + Name: "max_prepared_transactions", + Default: int64(0), + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum number of simultaneously prepared transactions.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_prepared_transactions", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_replication_slots": &Parameter{ + Name: "max_replication_slots", + Default: int64(10), + Category: "Replication / Sending Servers", + ShortDesc: "Sets the maximum number of simultaneously defined replication slots.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_replication_slots", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(10), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_slot_wal_keep_size": &Parameter{ + Name: "max_slot_wal_keep_size", + Default: int64(-1), + // Unit: "MB", + Category: "Replication / Sending Servers", + ShortDesc: "Sets the maximum WAL size that can be reserved by replication slots.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_slot_wal_keep_size", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_stack_depth": &Parameter{ + Name: "max_stack_depth", + Default: int64(2048), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum stack depth, in kilobytes.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("max_stack_depth", 100, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(2048), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_standby_archive_delay": &Parameter{ + Name: "max_standby_archive_delay", + Default: int64(30000), + // Unit: "ms", + Category: "Replication / Sending Servers", + ShortDesc: "Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_standby_archive_delay", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(30000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_standby_streaming_delay": &Parameter{ + Name: "max_standby_streaming_delay", + Default: int64(30000), + // Unit: "ms", + Category: "Replication / Standby Servers", + ShortDesc: "Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_standby_streaming_delay", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(30000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_sync_workers_per_subscription": &Parameter{ + Name: "max_sync_workers_per_subscription", + Default: int64(2), + Category: "Replication / Subscribers", + ShortDesc: "Maximum number of table synchronization workers per subscription.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_sync_workers_per_subscription", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_wal_senders": &Parameter{ + Name: "max_wal_senders", + Default: int64(10), + Category: "Replication / Sending Servers", + ShortDesc: "Sets the maximum number of simultaneously running WAL sender processes.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_wal_senders", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(10), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_wal_size": &Parameter{ + Name: "max_wal_size", + Default: int64(1024), + // Unit: "MB", + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Sets the WAL size that triggers a checkpoint.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("max_wal_size", 2, math.MaxInt32, false), + Source: ParameterSourceConfigurationFile, + ResetVal: int64(1024), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "max_worker_processes": &Parameter{ + Name: "max_worker_processes", + Default: int64(8), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Maximum number of concurrent worker processes.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("max_worker_processes", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(8), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "min_dynamic_shared_memory": &Parameter{ + Name: "min_dynamic_shared_memory", + Default: int64(0), + Category: "Resource Usage / Memory", + ShortDesc: "Amount of dynamic shared memory reserved at startup.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("min_dynamic_shared_memory", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "min_parallel_index_scan_size": &Parameter{ + Name: "min_parallel_index_scan_size", + Default: int64(1024), + // Unit: "8kB", + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the minimum amount of table data for a parallel scan.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("min_parallel_index_scan_size", 0, 715827882, false), + Source: ParameterSourceDefault, + ResetVal: int64(1024), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "min_parallel_table_scan_size": &Parameter{ + Name: "min_parallel_table_scan_size", + Default: int64(1024), + // Unit: "8kB", + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the minimum amount of table data for a parallel scan.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("min_parallel_table_scan_size", 0, 715827882, false), + Source: ParameterSourceDefault, + ResetVal: int64(1024), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "min_wal_size": &Parameter{ + Name: "min_wal_size", + Default: int64(80), + // Unit: "MB", + Category: "Write-Ahead Log / Checkpoints", + ShortDesc: "Sets the minimum size to shrink the WAL to.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("min_wal_size", 2, math.MaxInt32, false), + Source: ParameterSourceConfigurationFile, + ResetVal: int64(80), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "old_snapshot_threshold": &Parameter{ + Name: "old_snapshot_threshold", + Default: int64(-1), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Time before a snapshot is too old to read pages changed after the snapshot was taken.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("old_snapshot_threshold", -1, 86400, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "parallel_leader_participation": &Parameter{ + Name: "parallel_leader_participation", + Default: int8(1), + Category: "Resource Usage / Asynchronous Behavior", + ShortDesc: "Controls whether Gather and Gather Merge also run subplans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("parallel_leader_participation"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "parallel_setup_cost": &Parameter{ + Name: "parallel_setup_cost", + Default: float64(1000), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of starting up worker processes for parallel query.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("parallel_setup_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(1000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "parallel_tuple_cost": &Parameter{ + Name: "parallel_tuple_cost", + Default: float64(0.1), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of passing each tuple (row) from worker to leader backend.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("parallel_tuple_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(0.1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "password_encryption": &Parameter{ + Name: "password_encryption", + Default: "scram-sha-256", + Category: "Connections and Authentication / Authentication", + ShortDesc: "Chooses the algorithm for encrypting passwords.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("password_encryption", "md5", "scram-sha-256"), + Source: ParameterSourceDefault, + ResetVal: "scram-sha-256", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "plan_cache_mode": &Parameter{ + Name: "plan_cache_mode", + Default: "auto", + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Controls the planner's selection of custom or generic plan.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("plan_cache_mode", "auto", "force_generic_plan", "force_custom_plan"), + Source: ParameterSourceDefault, + ResetVal: "auto", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "port": &Parameter{ + Name: "port", + Default: int64(5432), + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the TCP port the server listens on.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("port", 1, 65535, false), + Source: ParameterSourceDefault, + ResetVal: int64(5432), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "post_auth_delay": &Parameter{ + Name: "post_auth_delay", + Default: int64(0), + // Unit: "s", + Category: "Developer Options", + ShortDesc: "Sets the amount of time to wait after authentication on connection startup.", + Context: ParameterContextBackend, + Type: types.NewSystemIntType("post_auth_delay", 0, 2147, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "pre_auth_delay": &Parameter{ + Name: "pre_auth_delay", + Default: int64(0), + // Unit: "s", + Category: "Developer Options", + ShortDesc: "Sets the amount of time to wait before authentication on connection startup.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("pre_auth_delay", 0, 60, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "primary_conninfo": &Parameter{ + Name: "primary_conninfo", + Default: "", + Category: "Replication / Standby Servers", + ShortDesc: "Sets the connection string to be used to connect to the sending server.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("primary_conninfo"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "primary_slot_name": &Parameter{ + Name: "primary_slot_name", + Default: "", + Category: "Replication / Standby Servers", + ShortDesc: "Sets the name of the replication slot to use on the sending server.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("primary_slot_name"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "quote_all_identifiers": &Parameter{ + Name: "quote_all_identifiers", + Default: int8(0), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "When generating SQL fragments, quote all identifiers.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("quote_all_identifiers"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "random_page_cost": &Parameter{ + Name: "random_page_cost", + Default: float64(4), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of a nonsequentially fetched disk page.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("random_page_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(4), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_end_command": &Parameter{ + Name: "recovery_end_command", + Default: "", + Category: "Write-Ahead Log / Archive Recovery", + ShortDesc: "Sets the shell command that will be executed once at the end of recovery.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("recovery_end_command"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_init_sync_method": &Parameter{ + Name: "recovery_init_sync_method", + Default: "fsync", + Category: "Error Handling", + ShortDesc: "Sets the method for synchronizing the data directory before crash recovery.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("recovery_init_sync_method", "fsync"), + Source: ParameterSourceDefault, + ResetVal: "fsync", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_min_apply_delay": &Parameter{ + Name: "recovery_min_apply_delay", + Default: int64(0), + // Unit: "ms", + Category: "Replication / Standby Servers", + ShortDesc: "Sets the minimum delay for applying changes during recovery.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("recovery_min_apply_delay", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_prefetch": &Parameter{ + Name: "recovery_prefetch", + Default: "try", + Category: "Write-Ahead Log / Recovery", + ShortDesc: "Prefetch referenced blocks during recovery.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("recovery_prefetch", "off", "on", "try"), + Source: ParameterSourceDefault, + ResetVal: "try", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target": &Parameter{ + Name: "recovery_target", + Default: "", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Set to \"immediate\" to end recovery as soon as a consistent state is reached.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_action": &Parameter{ + Name: "recovery_target_action", + Default: "pause", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets the action to perform upon reaching the recovery target.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("recovery_target_action", "pause", "promote", "shutdown"), + Source: ParameterSourceDefault, + ResetVal: "pause", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_inclusive": &Parameter{ + Name: "recovery_target_inclusive", + Default: int8(1), + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets whether to include or exclude transaction with recovery target.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("recovery_target_inclusive"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_lsn": &Parameter{ + Name: "recovery_target_lsn", + Default: "", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets the LSN of the write-ahead log location up to which recovery will proceed.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target_lsn"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_name": &Parameter{ + Name: "recovery_target_name", + Default: "", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets the named restore point up to which recovery will proceed.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target_name"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_time": &Parameter{ + Name: "recovery_target_time", + Default: "", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets the time stamp up to which recovery will proceed.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target_time"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_timeline": &Parameter{ + Name: "recovery_target_timeline", + Default: "latest", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Specifies the timeline to recover into.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target_timeline"), + Source: ParameterSourceDefault, + ResetVal: "latest", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recovery_target_xid": &Parameter{ + Name: "recovery_target_xid", + Default: "", + Category: "Write-Ahead Log / Recovery Target", + ShortDesc: "Sets the transaction ID up to which recovery will proceed.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("recovery_target_xid"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "recursive_worktable_factor": &Parameter{ + Name: "recursive_worktable_factor", + Default: float64(10), + Category: "Query Tuning / Other Planner Options", + ShortDesc: "Sets the planner's estimate of the average size of a recursive query's working table.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("recursive_worktable_factor", 0.001, 1000000), + Source: ParameterSourceDefault, + ResetVal: float64(10), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "remove_temp_files_after_crash": &Parameter{ + Name: "remove_temp_files_after_crash", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Remove temporary files after backend crash.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("remove_temp_files_after_crash"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "reserved_connections": &Parameter{ + Name: "reserved_connections", + Default: int64(0), + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the number of connection slots reserved for roles with privileges of pg_use_reserved_connections.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("reserved_connections", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "restart_after_crash": &Parameter{ + Name: "restart_after_crash", + Default: int8(1), + Category: "Error Handling", + ShortDesc: "Reinitialize server after backend crash.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("restart_after_crash"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "restore_command": &Parameter{ + Name: "restore_command", + Default: "", + Category: "Write-Ahead Log / Archive Recovery", + ShortDesc: "Sets the shell command that will be called to retrieve an archived WAL file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("restore_command"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "row_security": &Parameter{ + Name: "row_security", + Default: int8(1), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Enable row security.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("row_security"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "scram_iterations": &Parameter{ + Name: "scram_iterations", + Default: int64(4096), + Category: "Connections and Authentication / Authentication", + ShortDesc: "Sets the iteration count for SCRAM secret generation.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("scram_iterations", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(4096), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + // search_path has a hack currently: user-space dolt tables are stored with no schema, so to find them on the search + // path we need an empty schema path element. Instead, we should store them in the `dolt` schema and put the `dolt` + // schema on the path here. + "search_path": &Parameter{ + Name: "search_path", + Default: "\"$user\", public,", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the schema search order for names that are not schema-qualified.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("search_path"), + Source: ParameterSourceDefault, + ResetVal: "\"$user\", public", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "segment_size": &Parameter{ + Name: "segment_size", + Default: int64(131072), + // Unit: "8kB", + Category: "Preset Options", + ShortDesc: "Shows the number of pages per disk file.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("segment_size", 131072, 131072, false), + Source: ParameterSourceDefault, + ResetVal: int64(131072), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "send_abort_for_crash": &Parameter{ + Name: "send_abort_for_crash", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Send SIGABRT not SIGQUIT to child processes after backend crash.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("send_abort_for_crash"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "send_abort_for_kill": &Parameter{ + Name: "send_abort_for_kill", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Send SIGABRT not SIGKILL to stuck child processes.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("send_abort_for_kill"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "seq_page_cost": &Parameter{ + Name: "seq_page_cost", + Default: float64(1), + Category: "Query Tuning / Planner Cost Constants", + ShortDesc: "Sets the planner's estimate of the cost of a sequentially fetched disk page.", + Context: ParameterContextSighup, + Type: types.NewSystemDoubleType("seq_page_cost", 0, math.MaxFloat64), + Source: ParameterSourceDefault, + ResetVal: float64(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "server_encoding": &Parameter{ + Name: "server_encoding", + Default: "UTF8", + Category: "Preset Options", + ShortDesc: "Shows the server (database) character set encoding.", + Context: ParameterContextInternal, + Type: types.NewSystemStringType("server_encoding"), + Source: ParameterSourceDefault, + // BootVal: "SQL_ASCII", + ResetVal: "UTF8", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "server_version": &Parameter{ + Name: "server_version", + Default: "16.1 (Homebrew)", + Category: "Preset Options", + ShortDesc: "Shows the server version.", + Context: ParameterContextInternal, + Type: types.NewSystemStringType("server_version"), + Source: ParameterSourceDefault, + ResetVal: "16.1 (Homebrew)", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "server_version_num": &Parameter{ + Name: "server_version_num", + Default: int64(160001), + Category: "Preset Options", + ShortDesc: "Shows the server version as an integer.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("server_version_num", 160001, 160001, false), + Source: ParameterSourceDefault, + ResetVal: int64(160001), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "session_preload_libraries": &Parameter{ + Name: "session_preload_libraries", + Default: "", + Category: "Client Connection Defaults / Shared Library Preloading", + ShortDesc: "Lists shared libraries to preload into each backend.", + Context: ParameterContextSuperUser, + Type: types.NewSystemStringType("session_preload_libraries"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "session_replication_role": &Parameter{ + Name: "session_replication_role", + Default: "origin", + Category: "Write-Ahead Log / Archive Recovery", + ShortDesc: "Sets the session's behavior for triggers and rewrite rules.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("session_replication_role", "origin", "replica", "local"), + Source: ParameterSourceDefault, + ResetVal: "origin", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "shared_buffers": &Parameter{ + Name: "shared_buffers", + Default: int64(16384), + // Unit: "8kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the number of shared memory buffers used by the server.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("shared_buffers", 16, 1073741823, false), + Source: ParameterSourceConfigurationFile, + ResetVal: int64(16384), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "shared_memory_size": &Parameter{ + Name: "shared_memory_size", + Default: int64(143), + // Unit: "MB", + Category: "Preset Options", + ShortDesc: "Shows the size of the server's main shared memory area (rounded up to the nearest MB).", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("shared_memory_size", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + // BootVal: int64(0); + ResetVal: int64(143), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "shared_memory_size_in_huge_pages": &Parameter{ + Name: "shared_memory_size_in_huge_pages", + Default: int64(-1), + Category: "Preset Options", + ShortDesc: "Shows the number of huge pages needed for the main shared memory area.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("shared_memory_size_in_huge_pages", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "shared_memory_type": &Parameter{ + Name: "shared_memory_type", + Default: "mmap", + Category: "Resource Usage / Memory", + ShortDesc: "Selects the shared memory implementation used for the main shared memory region.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("shared_memory_type", "sysv", "mmap"), + Source: ParameterSourceDefault, + ResetVal: "mmap", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "shared_preload_libraries": &Parameter{ + Name: "shared_preload_libraries", + Default: "", + Category: "Client Connection Defaults / Shared Library Preloading", + ShortDesc: "Lists shared libraries to preload into server.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("shared_preload_libraries"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl": &Parameter{ + Name: "ssl", + Default: int8(0), + Category: "Connections and Authentication / SSL", + ShortDesc: "Enables SSL connections.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("ssl"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_ca_file": &Parameter{ + Name: "ssl_ca_file", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL certificate authority file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_ca_file"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_cert_file": &Parameter{ + Name: "ssl_cert_file", + Default: "server.crt", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL server certificate file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_cert_file"), + Source: ParameterSourceDefault, + ResetVal: "server.crt", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_ciphers": &Parameter{ + Name: "ssl_ciphers", + Default: "HIGH:MEDIUM:+3DES:!aNULL", + Category: "Connections and Authentication / SSL", + ShortDesc: "Sets the list of allowed SSL ciphers.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_ciphers"), + Source: ParameterSourceDefault, + ResetVal: "HIGH:MEDIUM:+3DES:!aNULL", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_crl_dir": &Parameter{ + Name: "ssl_crl_dir", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL certificate revocation list directory.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_crl_dir"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_crl_file": &Parameter{ + Name: "ssl_crl_file", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL certificate revocation list file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_crl_file"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_dh_params_file": &Parameter{ + Name: "ssl_dh_params_file", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL DH parameters file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_dh_params_file"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_ecdh_curve": &Parameter{ + Name: "ssl_ecdh_curve", + Default: "prime256v1", + Category: "Connections and Authentication / SSL", + ShortDesc: "Sets the curve to use for ECDH.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_ecdh_curve"), + Source: ParameterSourceDefault, + ResetVal: "prime256v1", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_key_file": &Parameter{ + Name: "ssl_key_file", + Default: "server.key", + Category: "Connections and Authentication / SSL", + ShortDesc: "Location of the SSL server private key file.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_key_file"), + Source: ParameterSourceDefault, + ResetVal: "server.key", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_library": &Parameter{ + Name: "ssl_library", + Default: "OpenSSL", + Category: "Preset Options", + ShortDesc: "Shows the name of the SSL library.", + Context: ParameterContextInternal, + Type: types.NewSystemStringType("ssl_library"), + Source: ParameterSourceDefault, + ResetVal: "OpenSSL", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_max_protocol_version": &Parameter{ + Name: "ssl_max_protocol_version", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Sets the maximum SSL/TLS protocol version to use.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("ssl_max_protocol_version", "", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_min_protocol_version": &Parameter{ + Name: "ssl_min_protocol_version", + Default: "TLSv1.2", + Category: "Connections and Authentication / SSL", + ShortDesc: "Sets the minimum SSL/TLS protocol version to use.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("ssl_min_protocol_version", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"), + Source: ParameterSourceDefault, + ResetVal: "TLSv1.2", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_passphrase_command": &Parameter{ + Name: "ssl_passphrase_command", + Default: "", + Category: "Connections and Authentication / SSL", + ShortDesc: "Command to obtain passphrases for SSL.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("ssl_passphrase_command"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_passphrase_command_supports_reload": &Parameter{ + Name: "ssl_passphrase_command_supports_reload", + Default: int8(0), + Category: "Connections and Authentication / SSL", + ShortDesc: "Controls whether ssl_passphrase_command is called during server reload.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("ssl_passphrase_command_supports_reload"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "ssl_prefer_server_ciphers": &Parameter{ + Name: "ssl_prefer_server_ciphers", + Default: int8(1), + Category: "Connections and Authentication / SSL", + ShortDesc: "Give priority to server ciphersuite order.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("ssl_prefer_server_ciphers"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "standard_conforming_strings": &Parameter{ + Name: "standard_conforming_strings", + Default: int8(1), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Causes '...' strings to treat backslashes literally.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("standard_conforming_strings"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "statement_timeout": &Parameter{ + Name: "statement_timeout", + Default: int64(0), + // Unit: "ms", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the maximum allowed duration of any statement.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("statement_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "stats_fetch_consistency": &Parameter{ + Name: "stats_fetch_consistency", + Default: "cache", + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Sets the consistency of accesses to statistics data.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("stats_fetch_consistency", "none", "cache", "snapshot"), + Source: ParameterSourceDefault, + ResetVal: "cache", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "superuser_reserved_connections": &Parameter{ + Name: "superuser_reserved_connections", + Default: int64(3), + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the number of connection slots reserved for superusers.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("superuser_reserved_connections", 0, 262143, false), + Source: ParameterSourceDefault, + ResetVal: int64(3), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "synchronize_seqscans": &Parameter{ + Name: "synchronize_seqscans", + Default: int8(1), + Category: "Version and Platform Compatibility / Previous PostgreSQL Versions", + ShortDesc: "Enable synchronized sequential scans.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("synchronize_seqscans"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "synchronous_commit": &Parameter{ + Name: "synchronous_commit", + Default: "on", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Sets the current transaction's synchronization level.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("synchronous_commit", "local", "remote_write", "remote_apply", "on", "off"), + Source: ParameterSourceDefault, + ResetVal: "on", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "synchronous_standby_names": &Parameter{ + Name: "synchronous_standby_names", + Default: "", + Category: "Replication / Primary Server", + ShortDesc: "Number of synchronous standbys and list of names of potential synchronous ones.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("synchronous_standby_names"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "syslog_facility": &Parameter{ + Name: "syslog_facility", + Default: "local0", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the syslog \"facility\" to be used when syslog enabled.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("syslog_facility", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7"), + Source: ParameterSourceDefault, + ResetVal: "local0", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "syslog_ident": &Parameter{ + Name: "syslog_ident", + Default: "postgres", + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Sets the program name used to identify PostgreSQL messages in syslog.", + Context: ParameterContextSighup, + Type: types.NewSystemStringType("syslog_ident"), + Source: ParameterSourceDefault, + ResetVal: "postgres", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "syslog_sequence_numbers": &Parameter{ + Name: "syslog_sequence_numbers", + Default: int8(1), + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Add sequence number to syslog messages to avoid duplicate suppression.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("syslog_sequence_numbers"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "syslog_split_messages": &Parameter{ + Name: "syslog_split_messages", + Default: int8(1), + Category: "Reporting and Logging / Where to Log", + ShortDesc: "Split messages sent to syslog by lines and to fit into 1024 bytes.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("syslog_split_messages"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "tcp_keepalives_count": &Parameter{ + Name: "tcp_keepalives_count", + Default: int64(0), + Category: "Connections and Authentication / TCP Settings", + ShortDesc: "Maximum number of TCP keepalive retransmits.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("tcp_keepalives_count", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "tcp_keepalives_idle": &Parameter{ + Name: "tcp_keepalives_idle", + Default: int64(0), + // Unit: "s", + Category: "Connections and Authentication / TCP Settings", + ShortDesc: "Time between issuing TCP keepalives.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("tcp_keepalives_idle", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "tcp_keepalives_interval": &Parameter{ + Name: "tcp_keepalives_interval", + Default: int64(0), + // Unit: "s", + Category: "Connections and Authentication / TCP Settings", + ShortDesc: "Time between TCP keepalive retransmits.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("tcp_keepalives_interval", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "tcp_user_timeout": &Parameter{ + Name: "tcp_user_timeout", + Default: int64(0), + // Unit: "ms", + Category: "Connections and Authentication / TCP Settings", + ShortDesc: "TCP user timeout.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("tcp_user_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "temp_buffers": &Parameter{ + Name: "temp_buffers", + Default: int64(1024), + // Unit: "8kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum number of temporary buffers used by each session.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("temp_buffers", 100, 1073741823, false), + Source: ParameterSourceDefault, + ResetVal: int64(1024), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "temp_file_limit": &Parameter{ + Name: "temp_file_limit", + Default: int64(-1), + // Unit: "kB", + Category: "Resource Usage / Disk", + ShortDesc: "Limits the total size of all temporary files used by each process.", + Context: ParameterContextSuperUser, + Type: types.NewSystemIntType("temp_file_limit", -1, math.MaxInt32, true), + Source: ParameterSourceDefault, + ResetVal: int64(-1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "temp_tablespaces": &Parameter{ + Name: "temp_tablespaces", + Default: "", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the tablespace(s) to use for temporary tables and sort files.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("temp_tablespaces"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "timezone": &Parameter{ + Name: "TimeZone", + Default: func() string { return time.Now().Location().String() }(), + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Sets the time zone for displaying and interpreting time stamps.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("timezone"), + Source: ParameterSourceConfigurationFile, + // BootVal: "GMT", + ResetVal: func() string { return time.Now().Location().String() }(), + Scope: GetPgsqlScope(PsqlScopeSession), + ValidateFunc: func(a any) (any, bool) { + switch v := a.(type) { + case string: + if strings.ToLower(v) == "local" { + // TODO: fix this + // https://pkg.go.dev/github.com/thlib/go-timezone-local/tzlocal seems useful in this case. + return "America/Los_Angeles", true + } else { + if strings.ToLower(v) == "utc" { + v = "UTC" + } + loc, err := time.LoadLocation(v) + if err == nil { + return loc.String(), true + } + _, err = TzOffsetToDuration(v) + if err == nil { + return v, true + } + return nil, false + } + } + return a, true + }, + }, + "timezone_abbreviations": &Parameter{ + Name: "timezone_abbreviations", + Default: "Default", + Category: "Client Connection Defaults / Locale and Formatting", + ShortDesc: "Selects a file of time zone abbreviations.", + Context: ParameterContextUser, + Type: types.NewSystemStringType("timezone_abbreviations"), + Source: ParameterSourceDefault, + ResetVal: "Default", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "trace_notify": &Parameter{ + Name: "trace_notify", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Generates debugging output for LISTEN and NOTIFY.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("trace_notify"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "trace_recovery_messages": &Parameter{ + Name: "trace_recovery_messages", + Default: "log", + Category: "Developer Options", + ShortDesc: "Enables logging of recovery-related debugging information.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("trace_recovery_messages", "debug5", "debug4", "debug3", "debug2", "debug1", "log", "notice", "warning", "error"), + Source: ParameterSourceDefault, + ResetVal: "log", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "trace_sort": &Parameter{ + Name: "trace_sort", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Emit information about resource usage in sorting.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("trace_sort"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_activities": &Parameter{ + Name: "track_activities", + Default: int8(1), + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Collects information about executing commands.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("track_activities"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_activity_query_size": &Parameter{ + Name: "track_activity_query_size", + Default: int64(1024), + // Unit: "B", + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Sets the size reserved for pg_stat_activity.query, in bytes.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("track_activity_query_size", 100, 1048576, false), + Source: ParameterSourceDefault, + ResetVal: int64(1024), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_commit_timestamp": &Parameter{ + Name: "track_commit_timestamp", + Default: int8(0), + Category: "Replication / Sending Servers", + ShortDesc: "Collects transaction commit time.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("track_commit_timestamp"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_counts": &Parameter{ + Name: "track_counts", + Default: int8(1), + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Collects statistics on database activity.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("track_counts"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_functions": &Parameter{ + Name: "track_functions", + Default: "none", + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Collects function-level statistics on database activity.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("track_functions", "none", "pl", "all"), + Source: ParameterSourceDefault, + ResetVal: "none", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_io_timing": &Parameter{ + Name: "track_io_timing", + Default: int8(0), + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Collects timing statistics for database I/O activity.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("track_io_timing"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "track_wal_io_timing": &Parameter{ + Name: "track_wal_io_timing", + Default: int8(0), + Category: "Statistics / Cumulative Query and Index Statistics", + ShortDesc: "Collects timing statistics for WAL I/O activity.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("track_wal_io_timing"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "transaction_deferrable": &Parameter{ + Name: "transaction_deferrable", + Default: int8(0), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("transaction_deferrable"), + Source: ParameterSourceOverride, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "transaction_isolation": &Parameter{ + Name: "transaction_isolation", + Default: "read committed", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the current transaction's isolation level.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("transaction_isolation", "serializable", "repeatable read", "read committed", "read uncommitted"), + Source: ParameterSourceOverride, + ResetVal: "read committed", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "transaction_read_only": &Parameter{ + Name: "transaction_read_only", + Default: int8(0), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets the current transaction's read-only status.", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("transaction_read_only"), + Source: ParameterSourceOverride, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "transform_null_equals": &Parameter{ + Name: "transform_null_equals", + Default: int8(0), + Category: "Version and Platform Compatibility / Other Platforms and Clients", + ShortDesc: "Treats \"expr=NULL\" as \"expr IS NULL\".", + Context: ParameterContextUser, + Type: types.NewSystemBoolType("transform_null_equals"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "unix_socket_directories": &Parameter{ + Name: "unix_socket_directories", + Default: "/tmp", + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the directories where Unix-domain sockets will be created.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("unix_socket_directories"), + Source: ParameterSourceDefault, + ResetVal: "/tmp", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "unix_socket_group": &Parameter{ + Name: "unix_socket_group", + Default: "", + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the owning group of the Unix-domain socket.", + Context: ParameterContextPostmaster, + Type: types.NewSystemStringType("unix_socket_group"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "unix_socket_permissions": &Parameter{ + Name: "unix_socket_permissions", + Default: int64(511), // displays in octal, which is 0777 + Category: "Connections and Authentication / Connection Settings", + ShortDesc: "Sets the access permissions of the Unix-domain socket.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("unix_socket_permissions", 0, 511, false), + Source: ParameterSourceDefault, + ResetVal: int64(511), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "update_process_title": &Parameter{ + Name: "update_process_title", + Default: int8(1), + Category: "Reporting and Logging / Process Title", + ShortDesc: "Updates the process title to show the active SQL command.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("update_process_title"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_buffer_usage_limit": &Parameter{ + Name: "vacuum_buffer_usage_limit", + Default: int64(256), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the buffer pool size for VACUUM, ANALYZE, and autovacuum.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_buffer_usage_limit", 0, 16777216, false), + Source: ParameterSourceDefault, + ResetVal: int64(256), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_cost_delay": &Parameter{ + Name: "vacuum_cost_delay", + Default: float64(0), + // Unit: "ms", + Category: "Resource Usage / Cost-Based Vacuum Delay", + ShortDesc: "Vacuum cost delay in milliseconds.", + Context: ParameterContextUser, + Type: types.NewSystemDoubleType("vacuum_cost_delay", 0, 100), + Source: ParameterSourceDefault, + ResetVal: float64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_cost_limit": &Parameter{ + Name: "vacuum_cost_limit", + Default: int64(200), + Category: "Resource Usage / Cost-Based Vacuum Delay", + ShortDesc: "Vacuum cost amount available before napping.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_cost_limit", 1, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(200), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_cost_page_dirty": &Parameter{ + Name: "vacuum_cost_page_dirty", + Default: int64(20), + Category: "Resource Usage / Cost-Based Vacuum Delay", + ShortDesc: "Vacuum cost for a page dirtied by vacuum.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_cost_page_dirty", 0, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(20), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_cost_page_hit": &Parameter{ + Name: "vacuum_cost_page_hit", + Default: int64(1), + Category: "Resource Usage / Cost-Based Vacuum Delay", + ShortDesc: "Vacuum cost for a page found in the buffer cache.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_cost_page_hit", 0, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_cost_page_miss": &Parameter{ + Name: "vacuum_cost_page_miss", + Default: int64(2), + Category: "Resource Usage / Cost-Based Vacuum Delay", + ShortDesc: "Vacuum cost for a page not found in the buffer cache.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_cost_page_miss", 0, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(2), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_failsafe_age": &Parameter{ + Name: "vacuum_failsafe_age", + Default: int64(1600000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Age at which VACUUM should trigger failsafe to avoid a wraparound outage.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_failsafe_age", 0, 2100000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(1600000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_freeze_min_age": &Parameter{ + Name: "vacuum_freeze_min_age", + Default: int64(50000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Minimum age at which VACUUM should freeze a table row.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_freeze_min_age", 0, 1000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(50000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_freeze_table_age": &Parameter{ + Name: "vacuum_freeze_table_age", + Default: int64(150000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Age at which VACUUM should scan whole table to freeze tuples.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_freeze_table_age", 0, 2000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(150000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_multixact_failsafe_age": &Parameter{ + Name: "vacuum_multixact_failsafe_age", + Default: int64(1600000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Multixact age at which VACUUM should trigger failsafe to avoid a wraparound outage.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_multixact_failsafe_age", 0, 2100000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(1600000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_multixact_freeze_min_age": &Parameter{ + Name: "vacuum_multixact_freeze_min_age", + Default: int64(5000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Minimum age at which VACUUM should freeze a MultiXactId in a table row.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_multixact_freeze_min_age", 0, 1000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(5000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "vacuum_multixact_freeze_table_age": &Parameter{ + Name: "vacuum_multixact_freeze_table_age", + Default: int64(150000000), + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Multixact age at which VACUUM should scan whole table to freeze tuples.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("vacuum_multixact_freeze_table_age", 0, 2000000000, false), + Source: ParameterSourceDefault, + ResetVal: int64(150000000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_block_size": &Parameter{ + Name: "wal_block_size", + Default: int64(8192), + Category: "Preset Options", + ShortDesc: "Shows the block size in the write ahead log.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("wal_block_size", 8192, 8192, false), + Source: ParameterSourceDefault, + ResetVal: int64(8192), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_buffers": &Parameter{ + Name: "wal_buffers", + Default: int64(512), + // Unit: "8kB", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Sets the number of disk-page buffers in shared memory for WAL.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("wal_buffers", -1, 262143, true), + Source: ParameterSourceDefault, + // BootVal: int64(-1), + ResetVal: int64(512), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_compression": &Parameter{ + Name: "wal_compression", + Default: "off", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Compresses full-page writes written in WAL file with specified method.", + Context: ParameterContextSuperUser, + Type: types.NewSystemEnumType("wal_compression", "pglz", "lz4", "on", "off"), + Source: ParameterSourceDefault, + ResetVal: "off", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_consistency_checking": &Parameter{ + Name: "wal_consistency_checking", + Default: "", + Category: "Developer Options", + ShortDesc: "Sets the WAL resource managers for which WAL consistency checks are done.", + Context: ParameterContextSuperUser, + Type: types.NewSystemStringType("wal_consistency_checking"), + Source: ParameterSourceDefault, + ResetVal: "", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_decode_buffer_size": &Parameter{ + Name: "wal_decode_buffer_size", + Default: int64(524288), + // Unit: "B", + Category: "Write-Ahead Log / Recovery", + ShortDesc: "Buffer size for reading ahead in the WAL during recovery.", + Context: ParameterContextPostmaster, + Type: types.NewSystemIntType("wal_decode_buffer_size", math.MaxUint16, 1073741823, false), + Source: ParameterSourceDefault, + ResetVal: int64(524288), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_init_zero": &Parameter{ + Name: "wal_init_zero", + Default: int8(1), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Writes zeroes to new WAL files before first use.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("wal_init_zero"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_keep_size": &Parameter{ + Name: "wal_keep_size", + Default: int64(0), + // Unit: "MB", + Category: "Replication / Sending Servers", + ShortDesc: "Sets the size of WAL files held for standby servers.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_keep_size", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_level": &Parameter{ + Name: "wal_level", + Default: "replica", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Sets the level of information written to the WAL.", + Context: ParameterContextPostmaster, + Type: types.NewSystemEnumType("wal_level", "minimal", "replica", "logical"), + Source: ParameterSourceDefault, + ResetVal: "replica", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_log_hints": &Parameter{ + Name: "wal_log_hints", + Default: int8(0), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modification.", + Context: ParameterContextPostmaster, + Type: types.NewSystemBoolType("wal_log_hints"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_receiver_create_temp_slot": &Parameter{ + Name: "wal_receiver_create_temp_slot", + Default: int8(0), + Category: "Replication / Standby Servers", + ShortDesc: "Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured.", + Context: ParameterContextSighup, + Type: types.NewSystemBoolType("wal_receiver_create_temp_slot"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_receiver_status_interval": &Parameter{ + Name: "wal_receiver_status_interval", + Default: int64(10), + // Unit: "s", + Category: "Replication / Standby Servers", + ShortDesc: "Sets the maximum interval between WAL receiver status reports to the sending server.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_receiver_status_interval", 0, 2147483, false), + Source: ParameterSourceDefault, + ResetVal: int64(10), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_receiver_timeout": &Parameter{ + Name: "wal_receiver_timeout", + Default: int64(60000), + Category: "Replication / Standby Servers", + ShortDesc: "Sets the maximum wait time to receive data from the sending server.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_receiver_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(60000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_recycle": &Parameter{ + Name: "wal_recycle", + Default: int8(1), + Category: "Write-Ahead Log / Settings", + ShortDesc: "Recycles WAL files by renaming them.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("wal_recycle"), + Source: ParameterSourceDefault, + ResetVal: int8(1), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_retrieve_retry_interval": &Parameter{ + Name: "wal_retrieve_retry_interval", + Default: int64(5000), + Category: "Replication / Standby Servers", + ShortDesc: "Sets the time to wait before retrying to retrieve WAL after a failed attempt.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_retrieve_retry_interval", 1, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(5000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_segment_size": &Parameter{ + Name: "wal_segment_size", + Default: int64(16777216), + // Unit: "B", + Category: "Preset Options", + ShortDesc: "Shows the size of write ahead log segments.", + Context: ParameterContextInternal, + Type: types.NewSystemIntType("wal_segment_size", 1048576, 1073741824, false), + Source: ParameterSourceDefault, + ResetVal: int64(16777216), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_sender_timeout": &Parameter{ + Name: "wal_sender_timeout", + Default: int64(60000), + // Unit: "ms", + Category: "Replication / Sending Servers", + ShortDesc: "Sets the maximum time to wait for WAL replication.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("wal_sender_timeout", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(60000), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_skip_threshold": &Parameter{ + Name: "wal_skip_threshold", + Default: int64(2048), + // Unit: "kB", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Minimum size of new file to fsync instead of writing WAL.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("wal_skip_threshold", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(2048), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_sync_method": &Parameter{ + Name: "wal_sync_method", + Default: "open_datasync", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Selects the method used for forcing WAL updates to disk.", + Context: ParameterContextSighup, + Type: types.NewSystemEnumType("wal_sync_method", "fsync", "fsync_writethrough", "fdatasync", "open_sync", "open_datasync"), + Source: ParameterSourceDefault, + ResetVal: "open_datasync", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_writer_delay": &Parameter{ + Name: "wal_writer_delay", + Default: int64(200), + // Unit: "ms", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Time between WAL flushes performed in the WAL writer.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_writer_delay", 1, 10000, false), + Source: ParameterSourceDefault, + ResetVal: int64(200), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "wal_writer_flush_after": &Parameter{ + Name: "wal_writer_flush_after", + Default: int64(128), + // Unit: "8kB", + Category: "Write-Ahead Log / Settings", + ShortDesc: "Amount of WAL written out by WAL writer that triggers a flush.", + Context: ParameterContextSighup, + Type: types.NewSystemIntType("wal_writer_flush_after", 0, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(128), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "work_mem": &Parameter{ + Name: "work_mem", + Default: int64(4096), + // Unit: "kB", + Category: "Resource Usage / Memory", + ShortDesc: "Sets the maximum memory to be used for query workspaces.", + Context: ParameterContextUser, + Type: types.NewSystemIntType("work_mem", 64, math.MaxInt32, false), + Source: ParameterSourceDefault, + ResetVal: int64(4096), + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "xmlbinary": &Parameter{ + Name: "xmlbinary", + Default: "base64", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets how binary values are to be encoded in XML.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("xmlbinary", "base64", "hex"), + Source: ParameterSourceDefault, + ResetVal: "base64", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "xmloption": &Parameter{ + Name: "xmloption", + Default: "content", + Category: "Client Connection Defaults / Statement Behavior", + ShortDesc: "Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments.", + Context: ParameterContextUser, + Type: types.NewSystemEnumType("xmloption", "content", "document"), + Source: ParameterSourceDefault, + ResetVal: "content", + Scope: GetPgsqlScope(PsqlScopeSession), + }, + "zero_damaged_pages": &Parameter{ + Name: "zero_damaged_pages", + Default: int8(0), + Category: "Developer Options", + ShortDesc: "Continues processing past damaged page headers.", + Context: ParameterContextSuperUser, + Type: types.NewSystemBoolType("zero_damaged_pages"), + Source: ParameterSourceDefault, + ResetVal: int8(0), + Scope: GetPgsqlScope(PsqlScopeSession), + }, +} diff --git a/pgserver/connection_handler.go b/pgserver/connection_handler.go index 78959c3c..f2f14aae 100644 --- a/pgserver/connection_handler.go +++ b/pgserver/connection_handler.go @@ -73,7 +73,13 @@ var pgIsInRecoveryRegex = regexp.MustCompile(`(?i)^\s*select\s+pg_catalog\.pg_is var pgWALLSNRegex = regexp.MustCompile(`(?i)^\s*select\s+pg_catalog\.(pg_current_wal_lsn|pg_last_wal_replay_lsn)\(\s*\)\s*;?\s*$`) // precompile a regex to match "select pg_catalog.current_setting('xxx');". -var currentSettingRegex = regexp.MustCompile(`(?i)^\s*select\s+pg_catalog.current_setting\(\s*['"]([^'"]+)['"]\s*\)\s*;?\s*$`) +var currentSettingRegex = regexp.MustCompile(`(?i)^\s*select\s+(pg_catalog.)?current_setting\(\s*['"]([^'"]+)['"]\s*\)\s*;?\s*$`) + +// precompile a regex to match "SHOW {ALL | var_name};". +var showVariablesRegex = regexp.MustCompile(`(?i)^\s*SHOW\s+(ALL|[a-zA-Z_][a-zA-Z0-9_]*)\s*;\s*$`) + +// precompile a regex to match "SET xxx TO 'yyy';" or "SET xxx = 'yyy';" or "SET xxx TO DEFAULT;" or "SET xxx = DEFAULT;". +var setStmtRegex = regexp.MustCompile(`(?i)^\s*SET\s+(SESSION|LOCAL)?\s*([a-zA-Z_][a-zA-Z0-9_]+)\s*(TO|=)\s*(DEFAULT|'([^']*)'|"([^"]*)"|[^'"\s;]+)\s*;?\s*$`) // precompile a regex to match any "from pg_catalog.xxx" in the query. var pgCatalogRegex = regexp.MustCompile(`(?i)\s+from\s+pg_catalog\.`) @@ -264,36 +270,49 @@ func (h *ConnectionHandler) handleStartup() (bool, error) { // sendClientStartupMessages sends introductory messages to the client and returns any error func (h *ConnectionHandler) sendClientStartupMessages() error { - parameters := []struct { + sessParams := []struct { Name string - Value string + Value any }{ - // These are mock parameter status messages that are sent to the client + // These are session parameter status messages that are sent to the client // to simulate a real PostgreSQL connection. Some clients may expect these // to be sent, like pgpool, which will not work without them. Because // if the paramter status message list sent by this server differs from // the list of the other real PostgreSQL servers, pgpool can not establish // a connection to this server. - {"in_hot_standby", "off"}, - {"integer_datetimes", "on"}, - {"TimeZone", "Etc/UTC"}, - {"IntervalStyle", "postgres"}, - {"is_superuser", "on"}, - {"application_name", "psql"}, - {"default_transaction_read_only", "off"}, - {"scram_iterations", "4096"}, - {"DateStyle", "ISO, MDY"}, - {"standard_conforming_strings", "on"}, - {"session_authorization", "postgres"}, - {"client_encoding", "UTF8"}, - {"server_version", "15.0"}, - {"server_encoding", "UTF8"}, - } - - for _, param := range parameters { + // Some of these may not exists in postgresConfigParameters(in doltgresql), + // which lists all the available parameters in PostgreSQL. In that case, + // we will use a mock value for that parameter. e.g. "on" for "is_superuser". + {"in_hot_standby", nil}, + {"integer_datetimes", nil}, + {"TimeZone", nil}, + {"IntervalStyle", nil}, + {"is_superuser", "on"}, // This is not specified in postgresConfigParameters now. + {"application_name", nil}, + {"default_transaction_read_only", nil}, + {"scram_iterations", nil}, + {"DateStyle", nil}, + {"standard_conforming_strings", nil}, + {"session_authorization", "postgres"}, // This is not specified in postgresConfigParameters now. + {"client_encoding", nil}, + {"server_version", nil}, + {"server_encoding", nil}, + } + + for _, param := range sessParams { + var value string + if param.Value != nil { + value = fmt.Sprintf("%v", param.Value) + } else { + _, v, ok := sql.SystemVariables.GetGlobal(param.Name) + if !ok { + return fmt.Errorf("error: %v variable was not found", param.Name) + } + value = fmt.Sprintf("%v", v) + } if err := h.send(&pgproto3.ParameterStatus{ Name: param.Name, - Value: param.Value, + Value: value, }); err != nil { return err } @@ -535,30 +554,59 @@ func (h *ConnectionHandler) readOneWALPositionStr() (string, error) { return lsn, nil } -// queryPGSetting will query the pg_catalog.pg_setting table to see if the setting is set -func (h *ConnectionHandler) queryPGSetting(name string) (string, error) { - // Grab a sql.Context. +// queryPGSetting will query the system variable value from the system variable map +func (h *ConnectionHandler) queryPGSetting(name string) (any, error) { + sysVar, _, ok := sql.SystemVariables.GetGlobal(name) + if !ok { + return nil, fmt.Errorf("error: %s variable was not found", name) + } ctx, err := h.duckHandler.NewContext(context.Background(), h.mysqlConn, "") + v, err := sysVar.GetSessionScope().GetValue(ctx, name, sql.Collation_Default) if err != nil { - return "", err + return nil, fmt.Errorf("error: %s variable was not found, err: %w", name, err) } - var setting string - if err := adapter.QueryRow(ctx, catalog.InternalTables.PGCurrentSetting.SelectStmt(), name).Scan(&setting); err != nil { - if errors.Is(err, stdsql.ErrNoRows) { - // if no this setting is found, return "" - return "", nil - } - return "", err + return v, nil +} + +// getSettingValue will get the value of the setting from the matching groups +func getSettingValue(matches []string) (string, bool) { + if matches[6] != "" { + return matches[6], false + } + if matches[5] != "" { + return matches[5], false } + return matches[4], strings.ToLower(matches[4]) == "default" +} - return setting, nil +// setSessionVar will set the session variable to the value provided +func (h *ConnectionHandler) setSessionVar(name string, value any, useDefault bool) (any, error) { + sysVar, _, ok := sql.SystemVariables.GetGlobal(name) + if !ok { + return nil, fmt.Errorf("error: %s variable was not found", name) + } + ctx, err := h.duckHandler.NewContext(context.Background(), h.mysqlConn, "") + if err != nil { + return nil, err + } + if useDefault { + value = sysVar.GetDefault() + } + err = sysVar.GetSessionScope().SetValue(ctx, name, value) + if err != nil { + return nil, err + } + v, err := sysVar.GetSessionScope().GetValue(ctx, name, sql.Collation_Default) + if err != nil { + return nil, fmt.Errorf("error: %s variable was not found, err: %w", name, err) + } + return v, nil } // TODO(sean): This is a temporary work around for clients that query the views from schema 'pg_catalog'. // Remove this once we add the views for 'pg_catalog'. func (h *ConnectionHandler) handlePgCatalogQueries(statement string) (bool, error) { - lower := strings.ToLower(statement) - if pgIsInRecoveryRegex.MatchString(lower) { + if pgIsInRecoveryRegex.MatchString(statement) { isInRecovery, err := h.isInRecovery() if err != nil { return false, err @@ -568,7 +616,7 @@ func (h *ConnectionHandler) handlePgCatalogQueries(statement string) (bool, erro StatementTag: "SELECT", }) } - if matches := pgWALLSNRegex.FindStringSubmatch(lower); len(matches) == 2 { + if matches := pgWALLSNRegex.FindStringSubmatch(statement); len(matches) == 2 { lsnStr, err := h.readOneWALPositionStr() if err != nil { return false, err @@ -578,19 +626,55 @@ func (h *ConnectionHandler) handlePgCatalogQueries(statement string) (bool, erro StatementTag: "SELECT", }) } - if matches := currentSettingRegex.FindStringSubmatch(lower); len(matches) == 2 { - setting, err := h.queryPGSetting(matches[1]) + if matches := currentSettingRegex.FindStringSubmatch(statement); len(matches) == 3 { + setting, err := h.queryPGSetting(matches[2]) if err != nil { return false, err } return true, h.query(ConvertedQuery{ - String: fmt.Sprintf(`SELECT '%s' AS "current_setting";`, setting), + String: fmt.Sprintf(`SELECT '%s' AS "current_setting";`, fmt.Sprintf("%v", setting)), StatementTag: "SELECT", }) } - if pgCatalogRegex.MatchString(lower) { + if matches := showVariablesRegex.FindStringSubmatch(statement); len(matches) == 2 { + key := strings.ToLower(matches[1]) + if key != "all" { + setting, err := h.queryPGSetting(key) + if err != nil { + return false, err + } + return true, h.query(ConvertedQuery{ + String: fmt.Sprintf(`SELECT '%s' AS "%s";`, fmt.Sprintf("%v", setting), key), + StatementTag: "SELECT", + }) + } + // TODO(sean): If the query is "SHOW ALL", we need to return all the system variables + } + if matches := setStmtRegex.FindStringSubmatch(statement); len(matches) == 7 { + key := matches[2] + value, isDefault := getSettingValue(matches) + newVal, err := h.setSessionVar(key, value, isDefault) + if err != nil { + return false, err + } + // Sent CommandComplete message + err = h.send(makeCommandComplete("SET", 0)) + if err != nil { + return true, err + } + // Sent ParameterStatus message + if err := h.send(&pgproto3.ParameterStatus{ + Name: key, + Value: fmt.Sprintf("%v", newVal), + }); err != nil { + return true, err + } + return true, nil + } + + if pgCatalogRegex.MatchString(statement) { return true, h.query(ConvertedQuery{ - String: pgCatalogRegex.ReplaceAllString(lower, " FROM __sys__."), + String: pgCatalogRegex.ReplaceAllString(statement, " FROM __sys__."), StatementTag: "SELECT", }) } diff --git a/pgtest/server.go b/pgtest/server.go index 890bdf35..09780559 100644 --- a/pgtest/server.go +++ b/pgtest/server.go @@ -10,6 +10,7 @@ import ( "github.com/apecloud/myduckserver/backend" "github.com/apecloud/myduckserver/catalog" "github.com/apecloud/myduckserver/pgserver" + pgConfig "github.com/apecloud/myduckserver/pgserver/config" sqle "github.com/dolthub/go-mysql-server" "github.com/dolthub/go-mysql-server/memory" "github.com/dolthub/go-mysql-server/server" @@ -63,6 +64,7 @@ func CreateTestServer(t *testing.T, port int) (ctx context.Context, pgServer *pg if err != nil { panic(err) } + pgConfig.Init() go pgServer.Start() ctx = context.Background()