Re: Large expressions in indexes can't be stored (non-TOASTable)
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Euler Taveira <euler@eulerto.com>
Cc: Michael Paquier <michael@paquier.xyz>, 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-11T21:21:02Z
Lists: pgsql-hackers
Attachments
On Wed, Apr 09, 2025 at 08:54:21PM -0300, Euler Taveira wrote:
> LGTM. I have a few suggestions.
Thanks for reviewing.
> + /*
> + * 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.
Hm. I agree that duplicating the comment isn't great, but I'm also not
wild about forcing readers to jump to the macro definition to figure out
why there is a length restriction.
> + errdetail("Repilcation origin names must be no longer than %d bytes.",
> + MAX_RONAME_LEN)));
>
> s/Repilcation/Replication/
Fixed.
> +#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.
We use both styles, but the no-parentheses style does seem to be preferred.
$ grep -E "^#define\s[A-Z_]+\s\([0-9]+\)$" src/* -rI | wc -l
23
$ grep -E "^#define\s[A-Z_]+\s[0-9]+$" src/* -rI | wc -l
861
> Should we document this maximum length?
I've added a note.
--
nathan
Commits
-
Ensure we have a snapshot when updating various system catalogs.
- fe8ea7a2a893 17.6 landed
- ddfcfb7cec68 15.14 landed
- b7ba2c0308ce 13.22 landed
- b65be6ef00e2 14.19 landed
- 706054b11b95 18.0 landed
- 24135398f1e1 16.10 landed
-
Remove pg_replication_origin's TOAST table.
- 16bf24e0e471 18.0 landed
-
Restrict password hash length.
- 8275325a06ed 18.0 cited
-
Ensure we have a snapshot when updating pg_index entries.
- b52adbad4674 18.0 landed
-
Add TOAST table to pg_index.
- b52c4fc3c09e 18.0 landed
-
Add toast tables to most system catalogs
- 96cdeae07f93 12.0 cited