From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
Cc: | 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: | 2024-10-16 00:12:31 |
Message-ID: | Zw8E73_nCk0DbO18@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Oct 14, 2024 at 03:02:22PM -0500, Nathan Bossart wrote:
> Here is a reorganized patch set. 0001 would be back-patched, but the
> others would only be applied to v18.
Right.
- if (!ctx->rel->rd_rel->reltoastrelid)
+ if (!OidIsValid(RelationGetToastRelid(ctx->rel)))
This set of diffs in 0002 is a nice cleanup. I'd wish for relying
less on zero comparitons when assuming that InvalidOid is in use.
+static inline void
+AssertHasSnapshotForToast(Relation rel)
+{
+ /* bootstrap mode in particular breaks this rule */
+ if (!IsNormalProcessingMode())
+ return;
+
+ /* if the relation doesn't have a TOAST table, we are good */
+ if (!OidIsValid(RelationGetToastRelid(rel)))
+ return;
+
+ Assert(HaveRegisteredOrActiveSnapshot());
+}
Using a separate inlined routine is indeed cleaner as you have
documented the assumptions behind the check. Wouldn't it be better to
use a USE_ASSERT_CHECKING block? These two checks for normal
processing and toastrelid are cheap lookups, but we don't need them at
all in non-assert paths, so I'd suggest to ignore them entirely for
the non-USE_ASSERT_CHECKING case.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-10-16 00:31:49 | Re: Doc: shared_memory_size_in_huge_pages with the "SHOW" command. |
Previous Message | Bruce Momjian | 2024-10-15 23:39:01 | Re: Doc: typo in config.sgml |