0F001
PostgreSQLERRORCriticalLocator ExceptionHIGH confidence
invalid locator specification
What this means
SQLSTATE 0F001 is raised when a large object locator (OID) specified by the client does not refer to an existing large object in pg_largeobject, or when the locator value itself is malformed.
Why it happens
- 1Passing a non-existent large object OID to lo_open, lo_read, lo_write, or lo_unlink
- 2Large object was deleted (lo_unlink) while a descriptor to it is still in use
How to reproduce
Opening a large object with an OID that does not exist.
trigger — this will error
trigger — this will error
SELECT lo_open(0, 262144); -- OID 0 does not exist
expected output
ERROR: invalid large-object descriptor
Fix
Verify the OID exists before operating on it
WHEN Before calling lo_open or related functions.
Verify the OID exists before operating on it
SELECT loid FROM pg_largeobject WHERE loid = :my_oid LIMIT 1;
Why this works
Check pg_largeobject to confirm the OID exists before opening. If missing, handle the absence gracefully in the application.
Sources
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev