Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iC9i1-00046K-55 for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Sep 2019 21:47:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iC9hy-00016R-TQ for pgsql-bugs@arkaria.postgresql.org; Sun, 22 Sep 2019 21:47:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iC9hy-00015u-Lh for pgsql-bugs@lists.postgresql.org; Sun, 22 Sep 2019 21:47:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iC9hw-0003Xa-Iv for pgsql-bugs@lists.postgresql.org; Sun, 22 Sep 2019 21:47:54 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8MLlnMs016291; Sun, 22 Sep 2019 17:47:49 -0400 From: Tom Lane To: daryl.waycott@edgeintelligence.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16013: Unexpected results from bit field query In-reply-to: <27542.1568864239@sss.pgh.pa.us> References: <16013-c2765b6996aacae9@postgresql.org> <27542.1568864239@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 18 Sep 2019 23:37:19 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16289.1569188869.1@sss.pgh.pa.us> Date: Sun, 22 Sep 2019 17:47:49 -0400 Message-ID: <16290.1569188869@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > PG Bug reporting form 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