omni_seq
omni_seq
omnigres : Distributed integer sequences
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2964 | omni_seq
|
omnigres
|
0.1.1 |
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.1.1 |
18
17
16
15
14
|
omnigres |
- |
| RPM | PIGSTY
|
0.1.1 |
18
17
16
15
14
|
omnigres_$v |
- |
| DEB | PIGSTY
|
0.1.1 |
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_seq; # install by extension name, for the current active PG version
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
pig install omni_seq -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION omni_seq;Usage
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 IDomni_seq.system_identifier()– Returns the unique 64-bit system identifier from pg_controlomni_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;Last updated on