Re: Large expressions in indexes can't be stored (non-TOASTable)

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Nisha Moond <nisha.moond412@gmail.com>, Euler Taveira <euler@eulerto.com>, Amit Kapila <amit.kapila16@gmail.com>, Alexander Lakhin <exclusion@gmail.com>, "Jonathan S. Katz" <jkatz@postgresql.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-28T02:43:52Z
Lists: pgsql-hackers
On Tue, May 27, 2025 at 03:02:52PM -0500, Nathan Bossart wrote:
> Here is what I have staged for commit for the others.  I'm hoping to push
> these in the next couple of days.

Thanks for the refreshed versions.  Looks sensible to me overall.

+static inline void
+AssertHasSnapshotForToast(Relation rel)
[...]
+    /*
+     * Commit 16bf24e fixed accesses to pg_replication_origin without a
+     * an active snapshot by removing its TOAST table.  On older branches,
+     * these bugs are left in place.  Its only varlena column is roname (the
+     * replication origin name), so this is only a problem if the name
+     * requires out-of-line storage, which seems unlikely.  In any case,
+     * fixing it doesn't seem worth extra code churn on the back-branches.
+     */
+    if (RelationGetRelid(rel) == ReplicationOriginRelationId)
+        return;

As of the back-branches but not HEAD, this shortcut makes sense.
--
Michael

Commits

  1. Ensure we have a snapshot when updating various system catalogs.

  2. Remove pg_replication_origin's TOAST table.

  3. Restrict password hash length.

  4. Ensure we have a snapshot when updating pg_index entries.

  5. Add TOAST table to pg_index.

  6. Add toast tables to most system catalogs