Re: BUG #19664: nbtree: Assertion failure when a custom index AM reuses bthandler

Поиск
Список
Период
Сортировка
Искать

Re: BUG #19664: nbtree: Assertion failure when a custom index AM reuses bthandler

От:
Andrey Borodin <x4mmm@yandex-team.ru>
Дата:


> On 7 Sep 2026, at 16:51, PG Bug reporting form  wrote:
> 
> CREATE ACCESS METHOD hx_orph_ix TYPE INDEX HANDLER bthandler;

I've toyed with reusing B-tree code in another index AM.  It is possible,
but this Assert is far from the only assumption that the code is dealing
with the built-in B-tree AM.  A grep finds 32 BTREE_AM_OID references in
19 files under src/, including nbtree, tuplesort, the planner, catalog and
DDL code, typcache, and RI triggers.  B-tree has grown into the core, and
that is not necessarily a problem.

I once made a working btree-fork extension by copying nbtree and fixing the
relevant assumptions [0].  So the implementation can be detached, but
that is quite different from registering the in-core bthandler under
another AM OID.  I don't think that use is documented or promised.

The gist2 regression case is a test hack, not a documented interface.  I
therefore don't think removing this one Assert would make this usage
valid.  The assertion failure could perhaps be replaced with a regular
error instead.


Best regards, Andrey Borodin.

[0] https://github.com/x4m/postgres_g/commit/58ced18d8901d9cf58c6aa8d82cc20e426e9517d



FAQ