Re: BUG #19018: high memory usage and "stack depth limit exceeded", with GiST index on ltree
Sergei Kornilov <sk@zsrv.org>
From: Sergei Kornilov <sk@zsrv.org>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: dull.bananas0@gmail.com, pgsql-bugs@lists.postgresql.org, Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Date: 2025-08-14T09:22:36Z
Lists: pgsql-bugs
Hello
This reminded me of some very old bug reports, like mine: https://www.postgresql.org/message-id/15431-7a89470f7879bed4%40postgresql.org
Still reproduces giving different results depending on the order of operations. The proposed patch makes the behavior the same in both cases.
Since this code path may be reachable by the user, instead of elog there should be ereport with a more user-friendly description. I would suggest something more like the text used for btree in a case like this. (ereport in _bt_check_third_page)
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("index row size %zu exceeds gist maximum %zu for index \"%s\""...
errdetail("Index row references tuple (%u,%u) in relation \"%s\".",...
errhint("Values larger than 1/2 of a buffer page cannot be indexed"...
regards, Sergei