pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: daryl.waycott@edgeintelligence.com
Subject: BUG #16013: Unexpected results from bit field query
Date: Wed, 18 Sep 2019 16:49:43 +0000
Message-ID: <16013-c2765b6996aacae9@postgresql.org> (raw)

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.



view thread (3+ messages)  latest in thread

Message-ID: <16013-c2765b6996aacae9@postgresql.org>
Permalink:  ../16013-c2765b6996aacae9@postgresql.org/
Also on:    postgresql.org/message-id/16013-c2765b6996aacae9@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, daryl.waycott@edgeintelligence.com
  Subject: Re: BUG #16013: Unexpected results from bit field query
  In-Reply-To: <16013-c2765b6996aacae9@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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