Skip to content

omni_seq

Distributed integer sequences

omnigres · Distributed integer sequences

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2964omni_seqomnigres0.1.1FEATApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.1.119 18 17 16 15omnigres-
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

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_seq;		# install by extension name

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

Create this extension with:

CREATE EXTENSION omni_seq;

Usage

omni_seq: Distributed integer sequences

The omni_seq extension provides distributed (prefixed) identifier types to work around PostgreSQL’s limitation where sequence data is not replicated in logical replication.

Types

Types follow the pattern omni_seq.id_<PREFIX_TYPE>_<ID_TYPE>. Supported base types: int16, int32, int64. When prefix and identifier types match, the shorthand omni_seq.id_int64 is available.

Create a Table with Distributed IDs

CREATE SEQUENCE seq;
CREATE TABLE t (
    id omni_seq.id_int64 PRIMARY KEY NOT NULL
       DEFAULT omni_seq.id_int64_nextval(omni_seq.system_identifier(), 'seq')
);

IDs display as PREFIX:IDENTIFIER (e.g., 7222168279780171472:1).

Functions

  • omni_seq.id_int64_nextval(node_id, sequence_name) – Generates the next distributed ID
  • omni_seq.system_identifier() – Returns the unique 64-bit system identifier from pg_control
  • omni_seq.id_int64_int32_make(prefix, identifier) – Constructs a distributed ID from components (useful during migrations)

Migration Example

BEGIN;
LOCK TABLE my_table;
ALTER TABLE my_table ALTER COLUMN id DROP IDENTITY IF EXISTS;
CREATE SEQUENCE my_table_id_seq;
ALTER TABLE my_table
    ALTER COLUMN id TYPE omni_seq.id_int64_int32
        USING omni_seq.id_int64_int32_make(0, id),
    ALTER COLUMN id SET DEFAULT omni_seq.id_int64_int32_nextval(
        omni_seq.system_identifier(), 'my_table_id_seq');
COMMIT;

Table reader