What is the 131072 in the call to lo_open()
This variable is called the "mode parameter" and it's the int representation of INV_READ (x'20000')

-- lo_open(lobjId oid, mode integer) returns integer
-- The mode parameter to lo_open uses two constants:
--   INV_READ  = 0x20000
--   INV_WRITE = 0x40000


You can see the integer representation like this,

SELECT CAST( x'20000' AS integer);
  int4  
--------
 131072
(1 row)


Personally, I would rather use x'20000' which I find to be more explicit. You can see INV_READ mentioned in a comment in largeobject.source, and you can see it defined it in the code at libpq-fs.h.

In the event you ever see 262144 that's the numified representation of INV_WRITE (0x40000).