← ClaudeAtlas

gucs-configlisted

Add or modify a custom GUC variable in a PostgreSQL backend patch or extension — covers DefineCustomBoolVariable / IntVariable / RealVariable / StringVariable / EnumVariable, picking the right GucContext (PGC_POSTMASTER / PGC_SIGHUP / PGC_SUSET / PGC_USERSET), MarkGUCPrefixReserved, the check/assign/show hook trio, GUC_LIST_INPUT / GUC_LIST_QUOTE / GUC_UNIT_MS / GUC_UNIT_KB / GUC_REPORT / GUC_EXPLAIN flags, and string-GUC guc_malloc rules. Use whenever a PG patch or extension calls DefineCustom*Variable, picks a GucContext, wires check/assign/show hooks, debugs a placeholder GUC, or marks a GUC reserved via MarkGUCPrefixReserved. Skip for DBA tuning of shared_buffers / max_connections / work_mem in production, dotenv / Viper / Dynaconf / Spring @Value configuration libraries, Kubernetes ConfigMap, Terraform variables, and non-PG application config systems.
matejformanek/postgres-claude · ★ 0 · AI & Automation · score 70
Install: claude install-skill matejformanek/postgres-claude
# gucs-config — custom GUC variables This is the procedural cookbook for adding custom GUC variables to a PostgreSQL backend patch or extension. For the conceptual model see `knowledge/idioms/guc-variables.md`. This skill is one of three siblings that share the `_PG_init` / postmaster-lifecycle boundary: - **gucs-config** (this skill) — custom GUC variables. - `bgworker-and-extensions` — RegisterBackgroundWorker, shared-library hooks. - `parallel-query` — ParallelContext + parallel-safe markings. ## 1. Picking the right Define*Variable Five typed entry points, all in `utils/guc.h`. [verified-by-code `source/src/include/utils/guc.h:358-416`] | Type | Function | Notes | |---|---|---| | bool | `DefineCustomBoolVariable` | | | int | `DefineCustomIntVariable` | with `minValue` / `maxValue` | | double | `DefineCustomRealVariable` | with `minValue` / `maxValue` | | string | `DefineCustomStringVariable` | `valueAddr` is `char **`, see §5 | | enum | `DefineCustomEnumVariable` | takes a `const struct config_enum_entry[]` | All five take the same trailing trio of hooks: `check_hook`, `assign_hook`, `show_hook` (any can be NULL). ## 2. GucContext — when the value can change [verified-by-code `source/src/include/utils/guc.h:71-80`] | `GucContext` | When the user can change it | |---|---| | `PGC_INTERNAL` | Never — display-only (e.g. `server_version`). | | `PGC_POSTMASTER` | Only at postmaster startup (`postgresql.conf` / cmd line). | | `PGC_SIGHUP` | Postmaster start OR config-re