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

Euler Taveira <euler@eulerto.com>

From: "Euler Taveira" <euler@eulerto.com>
To: "Nathan Bossart" <nathandbossart@gmail.com>, "Michael Paquier" <michael@paquier.xyz>
Cc: "Amit Kapila" <amit.kapila16@gmail.com>, "Alexander Lakhin" <exclusion@gmail.com>, "Tom Lane" <tgl@sss.pgh.pa.us>, "Jonathan S. Katz" <jkatz@postgresql.org>, "PostgreSQL Hackers" <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-09T23:54:21Z
Lists: pgsql-hackers
On Wed, Apr 9, 2025, at 4:05 PM, Nathan Bossart wrote:
> On Wed, Apr 09, 2025 at 01:20:29PM +0900, Michael Paquier wrote:
> > I guess that's the consensus, then.  No objections to the removal here.
> 
> That would look like the attached.  There are still a couple of other known
> TOAST snapshot issues I need to revisit, but this sidesteps a few of them.
> But this'll need to wait for a couple of months until v19 development
> begins.

LGTM. I have a few suggestions.
 
+   /*
+    * To avoid needing a TOAST table for pg_replication_origin, we restrict
+    * replication origin names to 512 bytes.  This should be more than enough
+    * for all practical use.
+    */
+   if (strlen(roname) > MAX_RONAME_LEN)
+       ereport(ERROR,

I wouldn't duplicate the comment. Instead, I would keep it only in origin.h.

+                errdetail("Repilcation origin names must be no longer than %d bytes.",
+                          MAX_RONAME_LEN)));

s/Repilcation/Replication/

+#define MAX_RONAME_LEN (512)

It is just a cosmetic suggestion but I usually use parentheses when it is an
expression but don't include it for a single number.

Should we document this maximum length?


--
Euler Taveira
EDB   https://www.enterprisedb.com/

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