lolor

lolor : Logical-replication-friendly replacement for PostgreSQL large objects

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9570
lolor
lolor
1.2.2
ETL
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-dt-
No
Yes
No
Yes
no
yes
Relationships
Schemaslolor
See Also
spock
snowflake

works on pgedge kernel fork. Requires lolor.node

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
1.2.2
18
17
16
15
14
lolor-
RPM
PIGSTY
1.2.2
18
17
16
15
14
lolor_$vpgedge_$v
DEB
PIGSTY
1.2.2
18
17
16
15
14
pgedge-$v-lolorpgedge-$v
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
el8.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
el9.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
el9.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
el10.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
el10.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
d12.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
d12.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
d13.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
d13.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
u22.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
u22.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
u24.x86_64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS
u24.aarch64
MISS
PIGSTY 1.2.2
MISS
MISS
MISS

Source

pig build pkg lolor;		# 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 lolor;		# install via package name, for the active PG version

pig install lolor -v 17;   # install for PG 17

Create this extension with:

CREATE EXTENSION lolor;

Usage

lolor: Logical-replication-friendly replacement for PostgreSQL large objects

Makes PostgreSQL large objects compatible with logical replication by storing them in non-catalog tables.

Enabling

CREATE EXTENSION lolor;

Configure the node identifier in postgresql.conf:

lolor.node = 1  -- unique node ID (1 to 2^28)

Optionally adjust the search path:

SET search_path = lolor, "$user", public, pg_catalog;

Large Object Operations

Once installed, the standard lo_* functions are redirected to use lolor’s tables:

-- Create a large object
SELECT lo_create(0);

-- Import a file into a large object
SELECT lo_import('/path/to/file.bin');

-- Export a large object to a file
SELECT lo_export(oid, '/path/to/output.bin');

-- Open, read, write, seek, close
SELECT lo_open(oid, x'40000'::int);  -- INV_WRITE
SELECT lowrite(fd, 'data'::bytea);
SELECT loread(fd, 1024);
SELECT lo_close(fd);

-- Delete a large object
SELECT lo_unlink(oid);

Replication Setup

Add lolor tables to your replication set:

-- For spock/pgedge replication
SELECT spock.repset_add_table('default', 'lolor.pg_largeobject');
SELECT spock.repset_add_table('default', 'lolor.pg_largeobject_metadata');

Internal Tables

The extension manages large objects in:

  • lolor.pg_largeobject - stores object data chunks
  • lolor.pg_largeobject_metadata - stores object metadata

Limitations

  • Native PostgreSQL large object functionality cannot be used while lolor is active
  • Migration of existing native large objects to lolor is not supported
  • ALTER LARGE OBJECT, GRANT ON LARGE OBJECT, COMMENT ON LARGE OBJECT, and REVOKE ON LARGE OBJECT are not supported
  • Requires PostgreSQL 16 or newer
Last updated on