Add TOAST support for more system tables

From: Sofia Kopikova <s(dot)kopikova(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add TOAST support for more system tables
Date: 2023-07-17 22:13:25
Message-ID: c5b7d324-0201-64a5-649b-24a78bce5224@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, hackers!

I've tried sending this patch to community before, let me try it second
time. Patch is revised and improved compared to previous version.

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. Patch fixes possible pg_upgrade
bug (problem with seeing a non-empty new cluster).

During code developing it turned out that heap_inplace_update function
is not suitable for use with TOAST, so its work could lead to wrong
statistics update (for example, during VACUUM). This problem is fixed
by adding new heap_inplace_update_prepare_tuple function -- we assume
TOASTed attributes are never changed by in-place update, and just
replace them with old values.

I also added pg_catalog_toast1 test that does check for "invalid tupple
length" error when creating index with toasted pg_class. Test grants and
drops roles on certain table many times to make ACL column long and then
creates index on this table.

I wonder what other bugs can happen there, but if anyone can give me a
hint, I'll try to fix them. Anyway, in PostgresPro we didn't encounter
any problems with this feature.

First attempt here:
https://www.postgresql.org/message-id/1643112264.186902312@f325.i.mail.ru

This time I'll do it better

--
Sofia Kopikova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-Add-TOAST-support-for-several-system-tables.patch text/x-patch 13.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-07-17 22:27:02 Re: ObjectIdGetDatum() missing from SearchSysCache*() callers
Previous Message Nathan Bossart 2023-07-17 20:47:44 Re: harmonize password reuse in vacuumdb, clusterdb, and reindexdb