pgsql: Fix additional breakage in covering-index patch. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix additional breakage in covering-index patch.
Date
Msg-id E1f5Hmo-0001Gx-PW@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix additional breakage in covering-index patch.

CheckIndexCompatible() misused ComputeIndexAttrs() by not bothering
to fill ii_NumIndexAttrs and ii_NumIndexKeyAttrs in the passed
IndexInfo.  Omission of ii_NumIndexAttrs was previously unimportant,
but now this matters because ComputeIndexAttrs depends on
ii_NumIndexKeyAttrs to decide how many columns it needs to report on.

(BTW, the fact that this oversight wasn't detected earlier implies
that we have no regression test verifying whether CheckIndexCompatible
ever succeeds.  Bad dog.  Not the job of this patch to fix it, though.)

Also, change the API of ComputeIndexAttrs so that it fills the opclass
output array for all column positions, as it does for the options output
array; positions for non-key index columns are filled with zeroes.
This isn't directly fixing any bug, but it seems like a good idea.

Per valgrind failure reports from buildfarm.

Alexander Korotkov, tweaked a bit by me

Discussion: https://postgr.es/m/CAPpHfduWrysrT-qAhn+3Ea5+Mg6Vhc-oA6o2Z-hRCPRdvf3tiw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b3b7f7898f17009912b3fc16620d042ec8482557

Modified Files
--------------
src/backend/commands/indexcmds.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: clarify explanation of pg_dump usage.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Indexes with INCLUDE columns and their support in B-tree