Skip to main content

Module largeobject

Module largeobject 

Source
Expand description

v7.39 (round 342+, V40) — the two large-object calls that touch a SERVER FILE.

lo_import('/path') and lo_export(oid, '/path') are the only members of the lo_* family that do file IO, and the engine is no_std — it has no filesystem. The rest of the family (round 306’s descriptor table, lo_get / lo_put / lo_from_bytea / lo_unlink) works entirely in the catalog and needs nothing from the host.

So these two follow the contract COPY … FROM '<file>' already uses (round 249): the shape and every message live here, in the engine, and each host — the server and the embedded API — supplies only the std::fs call. That keeps the two hosts saying the same thing.

PG 18.4, measured:

  • lo_import answers the new oid in a column named lo_import; lo_export answers 1 in a column named lo_export.
  • a missing input file is could not open server file "/x": No such file or directory;
  • an unwritable target is could not create server file "/x": No such file or directory;
  • both are superuser-only: permission denied for function lo_import.

Enums§

LoFileCall
A SELECT lo_import(…) / SELECT lo_export(…) the host must run, because it reads or writes a file.

Functions§

could_not_create
PG’s wording for a file it could not write.
could_not_open
PG’s wording for a file it could not read.
parse_lo_file_call
Recognise a bare SELECT lo_import(…) / SELECT lo_export(…).
permission_denied
PG’s wording when the caller is not a superuser.