Fix bitshiftright()'s zero-padding some more.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 30e5b3bbe9ca9f3594816788fe4469798da04f64
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2019-10-04T14:34:21Z
Releases: 9.6.16
Fix bitshiftright()'s zero-padding some more.

Commit 5ac0d9360 failed to entirely fix bitshiftright's habit of
leaving one-bits in the pad space that should be all zeroes,
because in a moment of sheer brain fade I'd concluded that only
the code path used for not-a-multiple-of-8 shift distances needed
to be fixed.  Of course, a multiple-of-8 shift distance can also
cause the problem, so we need to forcibly zero the extra bits
in both cases.

Per bug #16037 from Alexander Lakhin.  As before, back-patch to all
supported branches.

Discussion: https://postgr.es/m/16037-1d1ebca564db54f4@postgresql.org

Files

PathChange+/−
src/backend/utils/adt/varbit.c modified +4 −2
src/test/regress/expected/bit.out modified +66 −0
src/test/regress/sql/bit.sql modified +6 −0

Discussion