omni_var
omni_var
omnigres : Scoped variables
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2973 | omni_var
|
omnigres
|
0.3.0 |
FEAT
|
Apache-2.0
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d--
|
No
|
Yes
|
No
|
Yes
|
no
|
no
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
0.3.0 |
18
17
16
15
14
|
omnigres |
- |
| RPM | PIGSTY
|
0.3.0 |
18
17
16
15
14
|
omnigres_$v |
- |
| DEB | PIGSTY
|
0.3.0 |
18
17
16
15
14
|
postgresql-$v-omnigres |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
el8.aarch64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
el9.x86_64
|
MISS
|
PIGSTY 20250507
|
PIGSTY 20250507
|
PIGSTY 20250507
|
PIGSTY 20250507
|
el9.aarch64
|
MISS
|
PIGSTY 20250507
|
PIGSTY 20250507
|
PIGSTY 20250507
|
PIGSTY 20250507
|
el10.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
el10.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d12.x86_64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
d12.aarch64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
d13.x86_64
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
d13.aarch64
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
u22.x86_64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
u22.aarch64
|
MISS
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
PIGSTY 20250120
|
u24.x86_64
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
u24.aarch64
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
PIGSTY 20251108
|
Source
pig build pkg omnigres; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install omnigres; # install via package name, for the active PG version
pig install omni_var; # install by extension name, for the current active PG version
pig install omni_var -v 18; # install for PG 18
pig install omni_var -v 17; # install for PG 17
pig install omni_var -v 16; # install for PG 16
pig install omni_var -v 15; # install for PG 15
pig install omni_var -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION omni_var;Usage
The omni_var extension provides typed variables with transaction, session, and statement scopes.
Set Variables
SELECT omni_var.set('my_var', true); -- transaction scope
SELECT omni_var.set_session('my_var', true); -- session scope
SELECT omni_var.set_statement('my_var', true); -- statement scopeFor explicit typing:
SELECT omni_var.set('text_var', 'value'::text);Get Variables
SELECT omni_var.get('my_var', false); -- transaction scope, default=false
SELECT omni_var.get_session('my_var', false); -- session scope
SELECT omni_var.get_statement('my_var', false); -- statement scopeThe default value serves dual purposes: returned when the variable is not found, and its type specifies the expected return type.
Behavior
- If a variable is explicitly set to
null,getreturnsnull(not the default) - Mismatched type specifications raise errors:
ERROR: type mismatch DETAIL: expected integer, got boolean - Transaction-scoped variables are bound by the enclosing transaction lifetime
- Session variables persist throughout the session duration
Last updated on