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

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Euler Taveira <euler(at)eulerto(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Large expressions in indexes can't be stored (non-TOASTable)
Date: 2025-04-11 21:21:02
Message-ID: Z_mHvqVyGjEZhzl7@nathan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v2-0001-Remove-pg_replication_origin-s-TOAST-table.patch text/plain 7.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2025-04-11 21:42:26 Re: MergeJoin beats HashJoin in the case of multiple hash clauses
Previous Message Nathan Bossart 2025-04-11 21:02:06 Re: New committer: Jacob Champion