pg_variables
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_variables | 1.2.5 | FEAT | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2820 | pg_variables | No | Yes | No | Yes | No | Yes | - |
| Related | session_variable omni_var pg_fsql pg_query_rewrite |
|---|---|
| Depended By | pgelog |
Release tag 1.2.5 still ships extension SQL version 1.2.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.2.5 | 1817161514 | pg_variables | - |
| RPM | PIGSTY | 1.2.5 | 1817161514 | pg_variables_$v | - |
| DEB | PIGSTY | 1.2.5 | 1817161514 | postgresql-$v-pg-variables | - |
Build
You can build the RPM / DEB packages for pg_variables using pig build:
Install
You can install pg_variables directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
- Sources: README, repository tags, control file
pg_variables provides session-scoped variables grouped into named packages. Variables live only in the current session and are non-transactional by default unless created with is_transactional := true.
Basic Set And Get
Transactional variables participate in savepoints and rollbacks:
Core APIs
The README documents generic scalar and array APIs:
pgv_set(package, name, value, is_transactional default false)pgv_get(package, name, NULL::type, strict default true)
It also documents record-oriented APIs:
pgv_insert()pgv_update()pgv_delete()pgv_select()
Useful administration helpers include pgv_exists(), pgv_remove(), pgv_free(), pgv_list(), and pgv_stats().
Error And Strictness Behavior
pgv_get() checks both existence and type. The README shows that missing packages, missing variables, or mismatched types raise errors unless strict := false, in which case NULL is returned for missing values.
Deprecated Helpers And Version Note
Upstream still ships deprecated type-specific helpers such as pgv_set_int() / pgv_get_int() and pgv_set_jsonb() / pgv_get_jsonb(), but recommends the generic pgv_set() / pgv_get() API.
The repository tag is v1.2.5, while the current pg_variables.control file still declares default_version = '1.2'. That matches the packaging note that the release tag advanced without changing the SQL extension version string.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)