envvar
envvar
pg_envvar : Fetch the value of an environment variable
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4270 | envvar | pg_envvar | 1.0.1 | UTIL | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | session_variable gzip bzip zstd http pg_net pg_curl pgjq |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.1 | 18 17 16 15 14 | pg_envvar | - |
| RPM | PIGSTY | 1.0.1 | 18 17 16 15 14 | pg_envvar_$v | - |
| DEB | PIGSTY | 1.0.1 | 18 17 16 15 14 | postgresql-$v-pg-envvar | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
el8.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
el9.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
el9.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
el10.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
el10.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
d12.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
d12.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
d13.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
d13.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
u22.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
u22.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
u24.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
u24.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
Source
pig build pkg pg_envvar; # 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 pg_envvar; # install via package name, for the active PG version
pig install envvar; # install by extension name, for the current active PG version
pig install envvar -v 18; # install for PG 18
pig install envvar -v 17; # install for PG 17
pig install envvar -v 16; # install for PG 16
pig install envvar -v 15; # install for PG 15
pig install envvar -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION envvar;Usage
Provides a single function to read environment variables from the database server.
Function
get_env(name TEXT) RETURNS TEXTReturns the value of the specified environment variable set on the database server, or NULL if not set.
Examples
SELECT get_env('PGTZ');
-- UTC
SELECT get_env('HOME');
-- /var/lib/postgresql
SELECT get_env('PATH');
-- /usr/local/sbin:/usr/local/bin:...
SELECT get_env('NONEXISTENT');
-- NULLSchema Support
You can install the extension into a specific schema:
CREATE SCHEMA env;
CREATE EXTENSION envvar SCHEMA env;
SELECT env.get_env('PGTZ');Last updated on