session_variable
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
session_variable | 3.6 | SIM | GPL-3.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9120 | session_variable | No | Yes | No | Yes | No | No | session_variable |
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.6 | 1817161514 | session_variable | - |
| RPM | PIGSTY | 3.6 | 1817161514 | session_variable_$v | - |
| DEB | PIGSTY | 3.6 | 1817161514 | postgresql-$v-session-variable | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 3.6 el8.x86_64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 3.6 el8.x86_64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 3.6 el8.x86_64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 3.6 el8.x86_64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el8.x86_64.rpm
| PIGSTY 3.6 el8.x86_64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 3.6 el8.aarch64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 3.6 el8.aarch64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 3.6 el8.aarch64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 3.6 el8.aarch64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el8.aarch64.rpm
| PIGSTY 3.6 el8.aarch64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 3.6 el9.x86_64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 3.6 el9.x86_64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 3.6 el9.x86_64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 3.6 el9.x86_64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el9.x86_64.rpm
| PIGSTY 3.6 el9.x86_64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 3.6 el9.aarch64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 3.6 el9.aarch64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 3.6 el9.aarch64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 3.6 el9.aarch64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el9.aarch64.rpm
| PIGSTY 3.6 el9.aarch64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 3.6 el10.x86_64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 3.6 el10.x86_64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 3.6 el10.x86_64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 3.6 el10.x86_64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el10.x86_64.rpm
| PIGSTY 3.6 el10.x86_64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 3.6 el10.aarch64.pg18 : session_variable_18 session_variable_18-3.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 3.6 el10.aarch64.pg17 : session_variable_17 session_variable_17-3.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 3.6 el10.aarch64.pg16 : session_variable_16 session_variable_16-3.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 3.6 el10.aarch64.pg15 : session_variable_15 session_variable_15-3.6-1PGSTY.el10.aarch64.rpm
| PIGSTY 3.6 el10.aarch64.pg14 : session_variable_14 session_variable_14-3.6-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 3.6 d12.x86_64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 3.6 d12.x86_64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 3.6 d12.x86_64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 3.6 d12.x86_64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~bookworm_amd64.deb
| PIGSTY 3.6 d12.x86_64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 3.6 d12.aarch64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 3.6 d12.aarch64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 3.6 d12.aarch64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 3.6 d12.aarch64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~bookworm_arm64.deb
| PIGSTY 3.6 d12.aarch64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 3.6 d13.x86_64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~trixie_amd64.deb
| PIGSTY 3.6 d13.x86_64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~trixie_amd64.deb
| PIGSTY 3.6 d13.x86_64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~trixie_amd64.deb
| PIGSTY 3.6 d13.x86_64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~trixie_amd64.deb
| PIGSTY 3.6 d13.x86_64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 3.6 d13.aarch64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~trixie_arm64.deb
| PIGSTY 3.6 d13.aarch64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~trixie_arm64.deb
| PIGSTY 3.6 d13.aarch64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~trixie_arm64.deb
| PIGSTY 3.6 d13.aarch64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~trixie_arm64.deb
| PIGSTY 3.6 d13.aarch64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 3.6 u22.x86_64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~jammy_amd64.deb
| PIGSTY 3.6 u22.x86_64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~jammy_amd64.deb
| PIGSTY 3.6 u22.x86_64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~jammy_amd64.deb
| PIGSTY 3.6 u22.x86_64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~jammy_amd64.deb
| PIGSTY 3.6 u22.x86_64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 3.6 u22.aarch64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~jammy_arm64.deb
| PIGSTY 3.6 u22.aarch64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~jammy_arm64.deb
| PIGSTY 3.6 u22.aarch64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~jammy_arm64.deb
| PIGSTY 3.6 u22.aarch64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~jammy_arm64.deb
| PIGSTY 3.6 u22.aarch64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 3.6 u24.x86_64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~noble_amd64.deb
| PIGSTY 3.6 u24.x86_64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~noble_amd64.deb
| PIGSTY 3.6 u24.x86_64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~noble_amd64.deb
| PIGSTY 3.6 u24.x86_64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~noble_amd64.deb
| PIGSTY 3.6 u24.x86_64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 3.6 u24.aarch64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~noble_arm64.deb
| PIGSTY 3.6 u24.aarch64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~noble_arm64.deb
| PIGSTY 3.6 u24.aarch64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~noble_arm64.deb
| PIGSTY 3.6 u24.aarch64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~noble_arm64.deb
| PIGSTY 3.6 u24.aarch64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 3.6 u26.x86_64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~resolute_amd64.deb
| PIGSTY 3.6 u26.x86_64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~resolute_amd64.deb
| PIGSTY 3.6 u26.x86_64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~resolute_amd64.deb
| PIGSTY 3.6 u26.x86_64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~resolute_amd64.deb
| PIGSTY 3.6 u26.x86_64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 3.6 u26.aarch64.pg18 : postgresql-18-session-variable postgresql-18-session-variable_3.6-1PGSTY~resolute_arm64.deb
| PIGSTY 3.6 u26.aarch64.pg17 : postgresql-17-session-variable postgresql-17-session-variable_3.6-1PGSTY~resolute_arm64.deb
| PIGSTY 3.6 u26.aarch64.pg16 : postgresql-16-session-variable postgresql-16-session-variable_3.6-1PGSTY~resolute_arm64.deb
| PIGSTY 3.6 u26.aarch64.pg15 : postgresql-15-session-variable postgresql-15-session-variable_3.6-1PGSTY~resolute_arm64.deb
| PIGSTY 3.6 u26.aarch64.pg14 : postgresql-14-session-variable postgresql-14-session-variable_3.6-1PGSTY~resolute_arm64.deb
|
Build
You can build the RPM / DEB packages for session_variable using pig build:
Install
You can install session_variable 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:
session_variable defines database-level variables and constants with a separate value in each session. Changes to session-local values do not affect other connections.
Creating Variables and Constants
Getting and Setting Values
Using in PL/pgSQL
Administration Functions
Key Behaviors
- Variables are defined at the database level; each session gets a local copy
set()only changes the session-local copy; other sessions are unaffectedalter_value()changes the stored value; new sessions see it, existing sessions needinit()to refresh- Constants cannot be changed via
set(), only viaalter_value() - Variable and constant names must be unique across both types
Privileges, Reads and Version Boundaries
A superuser installs this non-relocatable extension in schema session_variable; no shared preload or restart is required for the SQL workflow. Grant session_variable_administrator_role to manage definitions and session_variable_user_role for ordinary access. The administrator role includes the user role.
session_variable.set and session_variable.alter_value return boolean true on success, not the previous value. A successful stored-definition change becomes visible in the caller immediately and in future sessions after commit; existing sessions keep their local state until session_variable.init() resets all values. Definitions are stored in session_variable.variables and included in logical backups.
session_variable.get_stable may cache a value during a statement; use the regular getter when a trigger changes that value within the same statement. session_variable.get_constant is IMMUTABLE and can return cached results after administrative constant changes; use the regular getter during such changes.
Release 3.6 removes obsolete version-1 initialization support. The preceding 3.5 rejects non-null initial values for collection and icollection because text initialization can crash a backend. For those types, create a null-initialized variable and follow the source’s initialization hook session_variable.variable_initialisation(); the README’s alternate hook name is inconsistent with the implementation. Upstream lists PostgreSQL 14-18 and provisional PostgreSQL 19 support.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)