I have set up postgres_fdw to access a 'remote' database (in fact its on the same server). Works fine. Except one of the columns is the oid of a large object, how can I read that data?
I worked out how to do this. The large object store can also be accessed via the pg_largeobject table. So I did
create foreign table if not exists global_lo (
loid oid not null,
pageno integer not null,
data bytea
)
server glob_serv options(table_name 'pg_largeobject', schema_name 'pg_catalog');
Now I can read a large object (all of it, I cannot stream etc) with
select data from global_lo where loid = 1234
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With