Skip to content

Installing and Configuring lolor

lolor is supported on Postgres versions 16 and later.

lolor ships with pgEdge Distributed Postgres and pgEdge Enterprise Postgres, so a pgEdge deployment provides the extension for you. The Control Plane installs the lolor package on each node as part of standard cluster setup.

If you manage Postgres yourself, you can compile and install the extension from the source code, following the same guidelines as any other Postgres extension built with PGXS. Make sure that your PATH environment variable includes the directory where pg_config (under your PostgreSQL installation) is located.

export PATH=/opt/pg16/bin:$PATH

# compile
make USE_PGXS=1
make USE_PGXS=1 install

lolor must be loaded at server start. Add it to shared_preload_libraries in postgresql.conf and restart; CREATE EXTENSION lolor, LOAD 'lolor' and any call that reaches one of lolor's functions fail with lolor must be loaded via "shared_preload_libraries" when the library was loaded on demand; the native pg_catalog.lo_* functions are not affected while lolor is not installed or is disabled. The guard that protects large objects when the extension is dropped is an object access hook, which is only in place in every backend when the library is preloaded.

shared_preload_libraries = 'lolor'

Then connect to your Postgres database as a superuser and create the extension. CREATE EXTENSION lolor renames the native large object functions, so lolor refuses the command while any other client session is connected to the database. Use the following command:

CREATE EXTENSION lolor;

Configuring lolor

You must set the lolor.node parameter on each node in your replication cluster before using the extension. The value can be from 1 to 15 (0 means unset); it is encoded in the four low bits of every large object OID lolor generates, so each node must use a different value.

lolor.node = 1

You can also change the search_path to pick large object related tables from the lolor schema:

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

lolor renames any existing methods in pg_catalog.lo_* to pg_catalog.lo_*_orig, and new versions of these methods are introduced. If you remove the extension, the renamed pg_catalog.lo_*_orig functions are restored to their initial names.

When you replicate large objects with Spock, the tables pg_largeobject, pg_largeobject_metadata and pg_largeobject_description must belong to your replication set. The third table holds the comment of each object that was migrated from native storage; without it, a lo_unlink() leaves the comment behind on the other nodes, and a node that is added or resynchronized later does not receive the comments. Connect to the lolor database and add them with spock.repset_add_table:

-- 'default' is Spock's built-in replication set; subscriptions consume it automatically.
SELECT spock.repset_add_table('default', 'lolor.pg_largeobject');
SELECT spock.repset_add_table('default', 'lolor.pg_largeobject_metadata');
SELECT spock.repset_add_table('default', 'lolor.pg_largeobject_description');