Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize
Дата
Msg-id CAApHDvqqvkorexCuVkSJ16LcqGKfUdLAn3Y+YsqKNT3Pe56oOA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize  (Alexander Lakhin <exclusion@gmail.com>)
Ответы Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize  (Alexander Lakhin <exclusion@gmail.com>)
Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Sat, 9 Sept 2023 at 20:00, Alexander Lakhin <exclusion@gmail.com> wrote:
> I've stumbled upon this issue one more time. With a query like this:
> CREATE TABLE t(id integer, node name);
> CREATE INDEX t_id_node_idx ON t(id, node);
> INSERT INTO t VALUES (1, 'node1');
>
> (Note that this time the error is triggered without the Memoize node.)

Yeah, it's really not a Memoize bug. It's an Index Only Scan bug.
I've added Robert to get his views.

> Maybe it makes sense to register the proposed patch on the commitfest at
> least to keep it in sight?

I've attached another patch which uses another method to fix this, per
an idea from Andres Freund.  I'd class it as a hack, but I don't have
any better ideas aside from the mammoth task of making name variable
length.  Indexes on name typed columns simply don't store all 64 bytes
of the name, so it's not safe to have code that assumes a name Datum
points to 64 bytes. The patch makes it so such a Datum *will* point to
64 bytes.  I've tried to do this as cheaply as possible by saving the
indexes to name columns in a new array in IndexOnlyScanState.  That
should make the overhead very small when indexes don't contain any
name-typed columns.

David

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: BUG #18305: Unexpected error: "WindowFunc not found in subplan target lists" triggered by subqueries
Следующее
От: Kostiantyn Tomakh
Дата:
Сообщение: Re: BUG #18433: Logical replication timeout