Re: BUG #16013: Unexpected results from bit field query

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

From: Tom Lane <tgl@sss.pgh.pa.us>
To: daryl.waycott@edgeintelligence.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2019-09-22T21:47:49Z
Lists: pgsql-bugs
I wrote:
> PG Bug reporting form <noreply@postgresql.org> writes:
>> A query using a right bit shift and an equality on a bit field seems to
>> return incorrect results.

> Ugh.  bit_cmp expects that any unused bits in the last byte
> are guaranteed zero, but bitshiftright isn't ensuring that.
> Didn't look to see if the same bug exists anywhere else ...

After digging around, it seems that no other bit functions have
this issue.  I've pushed a fix --- thanks for the report!

			regards, tom lane



Commits

  1. Fix failure to zero-pad the result of bitshiftright().