PostgreSQL Large Object LOgical Replication (LOLOR)
Repo pgEdge/lolor, read from GitHub 1 min ago. pgEdge has not joined Take My Repo.
pgEdge/lolor is a public repo on GitHub by pgEdge. PostgreSQL Large Object LOgical Replication (LOLOR). It declares the PostgreSQL license on GitHub. It is written mainly in C, has 51 stars and last changed on 2026-11-25. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-25.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
lolor is an extension that makes Postgres' Large Objects compatible with Logical Replication.
PostgreSQL supports large objects as related chunks as described in the pg_largeobject table. Large objects provide stream-style access to user data stored in a special large-object structure in the catalog. Large objects stored in catalog tables require special handling during replication; the lolor extension allows for the storage of large objects in non-catalog tables, aiding in replication of large objects.
lolor creates and manages large object related tables in the lolor schema:
lolor.pg_largeobject
lolor.pg_largeobject_metadata
PostgreSQL large objects allow you to store huge files within the database. Each large object is recognised by an OID that is assigned at the time of its creation. lolor stores objects in smaller segments within a separate system table and generates associated OIDs for large objects that are distinct from those of native large objects.
Use of the lolor extension requires Postgres 16 or newer.
You can also compile and install the extension from the source code, with the same guidelines as any other Postgres extension constructed using PGXS.
Make sure that your PATH environment variable includes the directory where pg_config (under your Postgres installation) is located.
export PATH=/usr/pgsql-17/bin:$PATH
# compile
make USE_PGXS=1
# install, might be requiring sudo for the installation step
make USE_PGXS=1 install
After installing the lolor extension, add it to shared_preload_libraries and restart the server (see Configuring lolor), then connect to your Postgres database as a superuser, with no other client session connected to it, and create the extension with the command:
CREATE EXTENSION lolor;
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'
You must set the lolor.node parameter 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
Any existing methods in pg_catalog.lo_* are renamed 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');
Migration is a manual step in both directions. Dropping the extension never moves data: it is refused while any object remains in lolor storage.
Migrate existing native large objects into lolor storage (requires superuser):
CREATE EXTENSION lolor; SELECT lolor.migrate_from_native();
To remove the extension, migrate the objects back first:
SELECT lolor.migrate_to_native(); DROP EXTENSION lolor;
The drop is refused while any object remains in lolor storage, on every path
that reaches the extension (DROP EXTENSION, DROP SCHEMA lolor CASCADE,
DROP OWNED BY). The drop itself moves no data; an event trigger puts the
native pg_catalog.lo_* names back first, so a normal drop of an enabled lolor
works. An object access hook makes the same checks when the extension is
deleted, and also refuses if lolor is still enabled at that point, for example
because event triggers are turned off. To discard whatever
is in lolor storage instead, a superuser can set lolor.allow_unsafe_drop = on
for the session that runs the drop. It skips every check, but the drop still
puts the native function names back, and stops with the error if a rename
fails, so that it can be tried again. Other sessions may be connected during
such a drop; they must reconnect before they use large objects again. If the
lo_on_drop_extension event trigger is disabled, nothing is renamed and the
drop warns that the names are still parked. While lolor is enabled, a normal
drop renames the native functions back, so it has the same requirements as
lolor.disable(): no other session connected to the database, and a client
session. A disabled lolor renames nothing, and the drop has no such
requirement.
Both directions preserve original OIDs, owners, ACLs, comments and data, and
copy pages verbatim so sparse large objects stay sparse. Moving an object to
native storage also reinstates its pg_shdepend entries, so DROP ROLE,
REASSIGN OWNED and DROP OWNED continue to see it.
migrate_to_native() does not require lolor to be enabled; it operates on the
catalogs directly.
migrate_from_native() does not check whether lolor is enabled. If lolor is
disabled, the objects still move into lolor storage, and the native
pg_catalog.lo_* functions then report that they do not exist. No data is
lost; the objects are reachable again after lolor.enable(). Enable lolor
before migrating so that applications never see that state.
Security labels on large objects cannot be represented in lolor storage and
cannot be reinstated without their label provider, so migrate_from_native()
refuses rather than discarding them. Remove them first if you hit this.
A helper supports verifying a migration across nodes:
SELECT * FROM lolor.digest(); -- per-object checksum, compare across nodes
Two helpers find and repair objects whose roles have been dropped:
SELECT * FROM lolor.check_orphans(); -- objects referring to a dropped role SELECT lolor.fix_orphans('some_role'); -- reassign them and drop dead ACL entries
When the spock extension is installed, both migration functions run under
spock.repair_mode(), so the row-shuffling migration DML is not
replicated to other nodes. This is essential for migrate_to_native(): its
deletes from the lolor tables would otherwise replicate while the native
re-creation stayed local, destroying large objects on the other nodes.
Even with spock, migration is refused if a non-spock logical replication slot
(e.g. pgoutput, wal2json) exists, since repair mode only suppresses spock's
own output plugin and those consumers would still decode the migration DML:
migrate_to_native() raises an ERROR, while migrate_from_native() warns and
returns -1 without doing anything. Drop the offending slots before migrating.
The check identifies spock's slots by their spock_output plugin.
Without spock, the migration DML cannot be excluded from logical decoding, so
both functions refuse to migrate while logical replication slots exist in the
database: migrate_from_native() raises a WARNING and returns -1 without
doing anything (0 is reserved for "nothing to migrate"), while
migrate_to_native() raises an ERROR. Drop all logical replication slots before
migrating; merely disabling a subscription is not sufficient, since its slot
retains the changes and delivers them when replication resumes.
Native large objects are never replicated, so before migration each node holds only the objects that were created on that node. Migration moves those objects into that node's lolor tables and does not replicate the rows. An object that existed on one node is therefore still on only that node afterwards. lolor replicates changes made from then on, so a later write to that object, or an unlink of it, reaches the other nodes as a change to rows they do not have.
Before migrating, count the objects on every node, both those still in native storage and any already in lolor storage, to see which nodes hold any:
SELECT (SELECT count(*) FROM lolor.native_lo_oids()) AS native, (SELECT count(*) FROM lolor.pg_largeobject_metadata) AS lolor;
How to proceed depends on where the native objects are:
If the database has a single node, install lolor and migrate first, and add the other nodes afterwards. The initial synchronization of a new node copies the lolor tables, because they are in the replication set.
If every node holds the same native objects, for example because the nodes were restored from one backup, migrate on each node. The lolor tables then match without any copying.
If one node holds every object, in either storage, migrate on each node that holds native objects, then resynchronize the lolor tables on each other node from that node. The resynchronization replaces the other node's copy of each table:
SELECT spock.sub_resync_table('mysub', 'lolor.pg_largeobject_metadata'); SELECT spock.sub_resync_table('mysub', 'lolor.pg_largeobject'); SELECT spock.sub_resync_table('mysub', 'lolor.pg_largeobject_description');
These calls return before the copy finishes, and each table is empty until its copy completes. Wait for the copies before you compare the nodes:
SELECT spock.sub_wait_for_sync('mysub');
If different nodes hold different objects, no node has the complete set and a resynchronization would discard objects. Migrated objects keep their OIDs, and a repair cannot keep two different objects under one OID, so check for shared OIDs first. On every node, collect the OIDs in both storages:
SELECT oid FROM lolor.native_lo_oids() UNION SELECT oid FROM lolor.pg_largeobject_metadata;
On each node, pass the other nodes' OIDs to the migration, as in
SELECT lolor.migrate_from_native(peer_oids => ARRAY[...]). The migration
refuses if any of those OIDs is also a native object on this node. Then copy
the rows that only one node has to the others, in all three lolor tables,
without deleting or overwriting any row. With ACE, run table-diff and then
table-repair --bidirectional on each table; a repair from one source of
truth would delete the objects that only the other nodes hold. If the diff
shows a row that differs between nodes, stop and resolve it by hand.
In every case, stop large object activity until the nodes agree. Check the
result of each migration call: it returns the number of objects it moved, and
-1 when it refused to run because of a logical replication slot, in which case
nothing moved. Finish by comparing lolor.digest() across the nodes.
pgEdge/lolor is a public repo on GitHub by pgEdge. PostgreSQL Large Object LOgical Replication (LOLOR).
It declares the PostgreSQL license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-25. GitHub counts 17 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run lolor. What is known comes from GitHub. It declares the PostgreSQL license on GitHub. Its last change was on 2026-11-25. It has 51 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.