GizStack
View .mdOpen in ChatGPTOpen in Claude

gizmodel/sql/catalog/gucs

PostgreSQL's configuration parameters, as pg_settings and SHOW ALL list them: the one owner of their names, boot values, units, limits and descriptions. A session's own values live in Conn.gucs.

gizlang
import * as Gucs from "gizmodel/sql/catalog/gucs";

Types

Guc

gizlang
type Guc = { name: string; boot: string; unit: string; category: string; vartype: string; context: string; min: string; max: string; enumvals: string; desc: string; extra: string; }

One parameter. boot is the value in the parameter's unit (as pg_settings.boot_val shows it).

  • name: string
  • boot: string
  • unit: string
  • category: string
  • vartype: string
  • context: string
  • min: string
  • max: string
  • enumvals: string
  • desc: string
  • extra: string

Functions

parseNumber

gizlang
function parseNumber(t: string): i64

The digits of t as a number (other characters skipped).

Effects: fail.

hostSettingDenied

gizlang
function hostSettingDenied(name: string): Option<DbError>

The refusal (42501) of a statement that sets NAME, as the statement wrote it, when it is a host setting.

Effects: fail, alloc.

gucTable

gizlang
function gucTable(): Vec<Guc>

The parameters, in name order.

Effects: fail, alloc.

unitShown

gizlang
function unitShown(value: string, unit: string): string

value (a number in the unit unit) as SHOW writes it: in the largest unit that divides it evenly (4096 kB: 4MB).

Effects: fail, alloc.

unitBase

gizlang
function unitBase(text: string, unit: string): string

A value a user wrote (4MB, 5s, 1h, 100) in the unit unit of its parameter; the text itself when it has no number.

Effects: fail, alloc.

settingDefaults

gizlang
function settingDefaults(): Vec<Vec<string>>

Name and value of each parameter as SHOW ALL lists them.

Effects: fail, alloc.

Constants

HOST_SETTINGS

gizlang
const HOST_SETTINGS = ["archive", "backups", "password"]

The settings that name a server path or hold a secret: gizdb.archive, gizdb.backups, gizdb.password. Only the host sets them, as start options or, for a database of gizdb cluster, through its folder (cluster.giz hostSetting). A statement never does: SET, set_config, ALTER ROLE and ALTER DATABASE refuse them (hostSettingDenied).