lo
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
lo | 1.1 | ADMIN | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 5930 | lo | No | Yes | No | Yes | Yes | No | - |
| Related | lolor pg_surgery pg_repack pglogical spock |
|---|
Version
| PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|
| 1.1 | 1.1 | 1.1 | 1.1 | 1.1 |
Install
Note: This is a built-in contrib extension of PostgreSQL
Usage
The lo extension provides a data type and trigger function for managing PostgreSQL Large Objects, preventing orphaned objects when references are updated or deleted.
Data Type
The lo type is a domain over oid, used to identify columns that hold Large Object references. This is especially useful for ODBC driver compatibility.
Trigger Function
The lo_manage() trigger automatically calls lo_unlink() to delete the associated Large Object when a row is updated or deleted:
For multiple lo columns, create a separate trigger for each:
To restrict the trigger to column updates only:
Limitations
DROP TABLEandTRUNCATEdo not fire row-level triggers, so Large Objects will be orphaned. RunDELETE FROM tablebefore dropping.- The trigger assumes each Large Object is referenced by only one column/row.
- Use the
vacuumloutility to clean up any orphaned Large Objects.
The extension is trusted and can be installed by non-superusers with CREATE privilege.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)