On Mon, Jul 17, 2023 at 06:31:04PM -0400, Tom Lane wrote:
> Sofia Kopikova <s.kopikova@postgrespro.ru> writes:
> > This patch adds TOAST support for system tables pg_class,
> > pg_attribute and pg_largeobject_metadata, as they include ACL columns,
> > which may be potentially large in size.
>
> We have been around on this topic before, cf discussion leading up to
> commit 96cdeae07. Allowing toasted data in pg_class or pg_attribute
> seems quite scary to me because of the potential for recursive access,
> particularly during cache-flush scenarios. (That is, you need to be
> able to read those catalogs on the way to fetching a toasted value,
> so how can you be sure that doesn't devolve into an infinite loop?)
Yep. I have something to add here. The last time I poked at that, I
was wondering about two code paths that have specific comments on this
matter. Based on my notes:
1) finish_heap_swap() in cluster.c:
* pg_class doesn't have a toast relation, so we don't need to update the
* corresponding toast relation. Not that there's little point moving all
* relfrozenxid updates here since swap_relation_files() needs to write to
* pg_class for non-mapped relations anyway.
2) extract_autovac_opts() in autovacuum.c:
* we acquired the pg_class row. If pg_class had a TOAST table, this would
* be a risk; fortunately, it doesn't.
What has been posted makes zero adjustments in these areas.
--
Michael