BUG #16013: Unexpected results from bit field query
The Post Office <noreply@postgresql.org>
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: daryl.waycott@edgeintelligence.com
Date: 2019-09-18T16:49:43Z
Lists: pgsql-bugs
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.
Commits
-
Fix failure to zero-pad the result of bitshiftright().
- 8a17afe84be6 9.4.25 landed
- 860216efa10a 12.0 landed
- 7e7abed056df 11.6 landed
- 6ddd164aaa34 9.6.16 landed
- 35eb132700ba 9.5.20 landed
- 096d34c3ba78 10.11 landed
- 5ac0d93600c1 13.0 landed