DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Version and Platform Compatibility / Previous PostgreSQL Versions

lo_compat_privileges

Enables backward compatibility mode for privilege checks on large objects. Skips privilege checks when reading or modifying large objects, for compatibility with PostgreSQL releases prior to 9.0.

  • Default: off
  • Type: bool
  • Applies: Session (superuser)

In plain words

Large objects (stored with lo_import, lo_create, OIDs pointing into pg_largeobject) have owners and privileges since PostgreSQL 9.0. Turning this on disables those checks, so any user can read or change any large object, as in releases before 9.0. Keep it off.

For DBAs and operators

With on, lo_open, loread, lowrite, lo_get, lo_put, lo_truncate and friends do not check SELECT/UPDATE privileges on the large object. The ownership checks of lo_unlink and COMMENT ON LARGE OBJECT are skipped too; GRANT and ALTER LARGE OBJECT … OWNER TO still require ownership (verified on 18.6). Server-side lo_import/lo_export on files is controlled separately (superuser or pg_read_server_files/pg_write_server_files).

Without it, a user who lacks access gets ERROR: permission denied for large object 16409. Fix with GRANT SELECT, UPDATE ON LARGE OBJECT 16409 TO app; or a migration that sets ownership, rather than this switch. Since PostgreSQL 18 you can also set default privileges for large objects (ALTER DEFAULT PRIVILEGES … ON LARGE OBJECTS).

Only superusers (and roles granted SET on this parameter) can change it.

How to change it

A superuser (or a role granted SET) can change it per session with SET.

See it in context

Roles and privileges

All Version and Platform Compatibility parameters