On Thu, Aug 8, 2024 at 2:46 AM Peter Eisentraut <pe...@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


Reply via email to