Hi,

While looking at coverage for nbtcompare.c on coverage.postgresql.org,
I noticed several btree skip-scan support routines (the per-type
skipsupport / increment / decrement helpers) are not exercised by the
existing regression tests.  Specifically:

  oid8:  btoid8skipsupport, oid8_decrement, oid8_increment
  int8:  btint8skipsupport, int8_decrement, int8_increment
  bool:  btboolskipsupport, bool_decrement, bool_increment
  char:  btcharskipsupport, char_decrement, char_increment
  oid:   oid_decrement
  int2:  int2_decrement

These functions feed into the skip-scan optimization added in
commit 92fe23d93aa for PG18, but the existing regression coverage
only exercises a few types (mostly int4 and varchar) on the leading
column of multi-column indexes.

The attached patch adds a small section to btree_index.sql that
creates a two-column index (a, b) for each missing type, then runs
forward and backward Index Only Scans with a predicate on the
non-leading column (b).  This forces the planner into a skip scan,
which in turn calls the per-type skip-support function plus the
increment/decrement helpers as it generates skip-array elements.

No code change in this patch. It's regression coverage only.

Tested with make check (245/245 pass).

Thanks,
Baji Shaik

Attachment: 0001-Add-regression-tests-for-btree-skip-scan-support-fun.patch
Description: Binary data

Reply via email to