Re: Don't overwrite scan key in systable_beginscan()

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Don't overwrite scan key in systable_beginscan()
Дата
Msg-id CA+Tgmoa_cFj7dOfMLDwyu=yjzvtpNhufZS3rGc2FGuAxsmQAdg@mail.gmail.com
обсуждение исходный текст
Ответ на Don't overwrite scan key in systable_beginscan()  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: Don't overwrite scan key in systable_beginscan()
Список pgsql-hackers
On Thu, Aug 8, 2024 at 2:46 AM Peter Eisentraut <peter@eisentraut.org> wrote:
> When systable_beginscan() and systable_beginscan_ordered() choose an
> index scan, they remap the attribute numbers in the passed-in scan keys
> to the attribute numbers of the index, and then write those remapped
> attribute numbers back into the scan key passed by the caller.  This
> second part is surprising and gratuitous.  It means that a scan key
> cannot safely be used more than once (but it might sometimes work,
> depending on circumstances).  Also, there is no value in providing these
> remapped attribute numbers back to the caller, since they can't do
> anything with that.
>
> I propose to fix that by making a copy of the scan keys passed by the
> caller and make the modifications there.

This does have the disadvantage of adding more palloc overhead.

--
Robert Haas
EDB: http://www.enterprisedb.com



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