Re: Modernize error message for malformed B-Tree tuple posting

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Modernize error message for malformed B-Tree tuple posting
Date: 2026-02-27 12:31:08
Message-ID: 59882068-C53F-41FF-B63E-CC4160E316BD@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 18 Feb 2026, at 12:58, Kirill Reshke <reshkekirill(at)gmail(dot)com> wrote:
>
> So, v1 changes the errcode for ERR_INDEX_CORRUPTION.

This totally makes sense to me.
And this seems the only such case in nbtdedup.c, other elog() are governing PageAddItem()'s
cant-happen case. As to others:

elog(ERROR, "fell off the end of index \"%s\"",
elog(ERROR, "no live root page found in index \"%s\"",
elog(ERROR, "root page %u of index \"%s\" has level %u, expected %u",

are of the same kind, but I do not remember seeing them on production.

> For including
> index name, we need
> to pass relation to _bt_swap_posting function, which I did not do in
> v1, because I'm not sure changing is worth it.

When it's the only message in the log - index name would be valuable.
Well, if it's overly complex - probably user (we) will be able to deduce corrupted index
from a query...

Best regards, Andrey Borodin.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wenhui qiu 2026-02-27 12:38:41 Re: [PROPOSAL] Doublewrite Buffer as an alternative torn page protection to Full Page Write
Previous Message Akshay Joshi 2026-02-27 12:22:36 Re: [PATCH] Add pg_get_database_ddl() function to reconstruct CREATE DATABASE statement