PostgreSQL - Find corresponding table of a LOB

168 Views Asked by At

I'm using PostgreSQL 9.4.

When a table A uses a LOB, PostgreSQL stores it in a separate table, pg_largeobject, and table A holds a reference to an entry in pg_largeobject.

Given a LOB entry in pg_largeobject (or more specifically, the LOB ID), is there a way to find out the table that owns said LOB?

1

There are 1 best solutions below

0
jjanes On

No. It doesn't even need to be referenced by any table at all. A LOB could be completely unreferenced, or could be referenced only by an OID which someone jotted down on a sticky note and then put in a safe deposit box.

You could make the same pragmatic assumption that vacuumlo does, and scour every table with columns of type "oid" or "lo".