gucs-configlisted
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