pgsql: Initialize the entryRes array between each call to triConsistent

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема pgsql: Initialize the entryRes array between each call to triConsistent
Дата
Msg-id E1WBogq-0007fC-0x@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Initialize the entryRes array between each call to triConsistent.

The shimTriConstistentFn, which calls the opclass's consistent function with
all combinations of TRUE/FALSE for any MAYBE argument, modifies the entryRes
array passed by the caller. Change startScanKey to re-initialize it between
each call to accommodate that.

It's actually a bad habit by shimTriConsistentFn to modify its argument. But
the only caller that doesn't already re-initialize the entryRes array was
startScanKey, and it's easy for startScanKey to do so. Add a comment to
shimTriConsistentFn about that.

Note: this does not give a free pass to opclass-provided consistent
functions to modify the entryRes argument; shimTriConsistent assumes that
they don't, even though it does it itself.

While at it, refactor startScanKey to allocate the requiredEntries and
additionalEntries after it knows exactly how large they need to be. Saves a
little bit of memory, and looks nicer anyway.

Per complaint by Tom Lane, buildfarm and the pg_trgm regression test.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6aa2bdf6a01ce099e315cb313396ca4b8415321b

Modified Files
--------------
src/backend/access/gin/ginget.c   |   40 +++++++++++++++++++++++--------------
src/backend/access/gin/ginlogic.c |    6 ++++--
2 files changed, 29 insertions(+), 17 deletions(-)


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: pgsql: Speed up "rare & frequent" type GIN queries.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Mark some more variables as static or include the appropriate he