public inbox for [email protected]  
help / color / mirror / Atom feed
Re: Introduction of a new field in pg_class indicating presence of a large object in a table
2+ messages / 2 participants
[nested] [flat]

* Re: Introduction of a new field in pg_class indicating presence of a large object in a table
@ 2024-04-30 19:13 David G. Johnston <[email protected]>
  2024-04-30 19:28 ` Re: Introduction of a new field in pg_class indicating presence of a large object in a table Tom Lane <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: David G. Johnston @ 2024-04-30 19:13 UTC (permalink / raw)
  To: Gaurav Pant <[email protected]>; +Cc: [email protected]

On Tue, Apr 30, 2024 at 11:57 AM Gaurav Pant <[email protected]>
wrote:

> I wanted to know if there is any such system table that we can use to
> identify and map the fields containing large objects and the respective
> tables and if it is not already there, do we have any plans to incorporate
> the same in pg_class like we have for pg_toast?
>
>
https://www.postgresql.org/docs/current/catalog-pg-largeobject.html

Large Objects are nothing like TOAST.  There is no system level association
between large objects and tables.  Sure, the DBA can choose to store a
large object OID in a table, but how you'd go about figuring out which
columns contain those is going to be installation specific.  Though
hopefully they used a bigint data type and maybe added "oid" to the column
name...I suppose it would be interesting if one could define a FK on a
table and point it at pg_largeobject_metadata but that I suspect would be
the extent to which we'd do something along the lines of your request.

David J.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Introduction of a new field in pg_class indicating presence of a large object in a table
  2024-04-30 19:13 Re: Introduction of a new field in pg_class indicating presence of a large object in a table David G. Johnston <[email protected]>
@ 2024-04-30 19:28 ` Tom Lane <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2024-04-30 19:28 UTC (permalink / raw)
  To: David G. Johnston <[email protected]>; +Cc: Gaurav Pant <[email protected]>; [email protected]

"David G. Johnston" <[email protected]> writes:
> On Tue, Apr 30, 2024 at 11:57 AM Gaurav Pant <[email protected]>
> wrote:
>> I wanted to know if there is any such system table that we can use to
>> identify and map the fields containing large objects and the respective
>> tables and if it is not already there, do we have any plans to incorporate
>> the same in pg_class like we have for pg_toast?

> Large Objects are nothing like TOAST.  There is no system level association
> between large objects and tables.  Sure, the DBA can choose to store a
> large object OID in a table, but how you'd go about figuring out which
> columns contain those is going to be installation specific.

Yeah.  You might want to look at contrib/vacuumlo, but realize that
that's fairly heuristic.

> Though
> hopefully they used a bigint data type and maybe added "oid" to the column
> name...I suppose it would be interesting if one could define a FK on a
> table and point it at pg_largeobject_metadata but that I suspect would be
> the extent to which we'd do something along the lines of your request.

That would solve the opposite problem, of preventing a column from
containing any OIDs that *weren't* large object OIDs.  Given that
recording a large object OID elsewhere in the database is purely
an application decision, I don't think there's a reasonable way
for the system to track it.

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-04-30 19:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 19:13 Re: Introduction of a new field in pg_class indicating presence of a large object in a table David G. Johnston <[email protected]>
2024-04-30 19:28 ` Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox