Skip to content

omni_session

Session management

omnigres · Session management

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2966omni_sessionomnigres0.2.0FEATApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--NoNoNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.2.019 18 17 16 15omnigresomni_var, omni_id, omni_web, omni_httpd, omni_polyfill
RPMPIGSTY2026021219 18 17 16 15omnigres_$vpostgresql$v-contrib, postgresql$v-plpython3, python3-pip
DEBPIGSTY2026021219 18 17 16 15postgresql-$v-omnigrespostgresql-plpython3-$v, python3-pip
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el8.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el9.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
el10.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d12.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
d13.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u22.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u24.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.x86_64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212
u26.aarch64N/APIGSTY 20260212PIGSTY 20260212PIGSTY 20260212PIGSTY 20260212

Source

docs.omnigres.org/omni_session/session_management/

pig build pkg omnigres;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install omnigres;		# install by package name
pig install omni_session;		# install by extension name

pig install omni_session -v 18;   # install for PG 18
pig install omni_session -v 17;   # install for PG 17
pig install omni_session -v 16;   # install for PG 16
pig install omni_session -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION omni_session CASCADE; -- requires omni_var, omni_id, omni_web, omni_httpd, omni_polyfill

Usage

omni_session: Session management

The omni_session extension provides standardized session management, creating an unlogged omni_session.sessions table for active sessions. Works primarily with the HTTP stack.

Session Handler for HTTP

Request handler – Extracts session UUID from a _session cookie:

SELECT omni_session.session_handler(request);
-- Optional: session_handler(request, cookie_name => 'my_session')

Creates a new session if the cookie is missing or invalid, sets the omni_session.session transaction variable.

Response handler – Sets the session cookie on the response:

SELECT omni_session.session_handler(response);

Cookie parameters:

ParameterDefaultDescription
cookie_name_sessionCookie identifier
http_onlytruePrevents JavaScript access
securetrueHTTPS-only
same_siteLaxCross-site behavior
domainnullDomain scope
max_agenullLifetime in seconds
expiresnullExpiration timestamp
pathnullURL path scope

Direct Session ID Handling

-- Create or validate a session:
SELECT omni_session.session_handler(null::omni_session.session_id);
-- Returns new session ID and sets omni_session.session transaction variable

Table reader