pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16013: Unexpected results from bit field query
3+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2019-09-22 5ac0d93600 6ddd164aaa 860216efa1 7e7abed056 096d34c3ba 35eb132700 8a17afe84b Fix failure to zero-pad the result of bitshiftright().
* BUG #16013: Unexpected results from bit field query
@ 2019-09-18 16:49 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: PG Bug reporting form @ 2019-09-18 16:49 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: daryl.waycott@edgeintelligence.com
The following bug has been logged on the website:
Bug reference: 16013
Logged by: Daryl Waycott
Email address: daryl.waycott@edgeintelligence.com
PostgreSQL version: 9.6.9
Operating system: Ubuntu 18.04.2 LTS
Description:
A query using a right bit shift and an equality on a bit field seems to
return incorrect results. See the following snippet:
DROP TABLE IF EXISTS table1;
CREATE TABLE table1(col_bit_10_1 bit(10) NULL);
INSERT INTO table1 VALUES (B'0000000000');
INSERT INTO table1 VALUES (B'0000000001');
select col_bit_10_1>>1 from table1;
select col_bit_10_1 from table1 where col_bit_10_1>>1 = B'0000000000';
Results:
DROP TABLE
CREATE TABLE
INSERT 0 1
INSERT 0 1
?column?
------------
0000000000
0000000000
(2 rows)
col_bit_10_1
--------------
0000000000
(1 row)
The second result set should include both rows.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #16013: Unexpected results from bit field query
@ 2019-09-19 03:37 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2019-09-19 03:37 UTC (permalink / raw)
To: daryl.waycott@edgeintelligence.com; +Cc: pgsql-bugs@lists.postgresql.org
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 ...
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #16013: Unexpected results from bit field query
@ 2019-09-22 21:47 Tom Lane <tgl@sss.pgh.pa.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2019-09-22 21:47 UTC (permalink / raw)
To: daryl.waycott@edgeintelligence.com; +Cc: pgsql-bugs@lists.postgresql.org
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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-09-22 21:47 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 16:49 BUG #16013: Unexpected results from bit field query PG Bug reporting form <noreply@postgresql.org>
2019-09-19 03:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-09-22 21:47 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox