Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4EAC9B5DC14 for ; Mon, 1 Aug 2011 20:01:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 48550-03 for ; Mon, 1 Aug 2011 23:01:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-vbr18.xs4all.nl (smtp-vbr18.xs4all.nl [194.109.24.38]) by mail.postgresql.org (Postfix) with ESMTP id B7D9DB5DC04 for ; Mon, 1 Aug 2011 20:01:11 -0300 (ADT) Received: from spoetnik.xs4all.nl (spoetnik.xs4all.nl [82.95.228.65]) by smtp-vbr18.xs4all.nl (8.13.8/8.13.8) with ESMTP id p71N1A2f041685 for ; Tue, 2 Aug 2011 01:01:10 +0200 (CEST) (envelope-from reinoud.v@n.leeuwen.net) Received: by spoetnik.xs4all.nl (Postfix, from userid 1000) id CA24F1CC9B; Tue, 2 Aug 2011 01:01:09 +0200 (CEST) Date: Tue, 2 Aug 2011 01:01:09 +0200 From: Reinoud van Leeuwen To: pgsql-sql@postgresql.org Subject: Re: why these results? Message-ID: <20110801230109.GS18120@spoetnik.xs4all.nl> Mail-Followup-To: pgsql-sql@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201108/3 X-Sequence-Number: 35671 On Mon, Aug 01, 2011 at 04:50:00PM -0600, Wes James wrote: > select count(*) from table; > > count > ------- > 100 > (1 row) > > > is correct > > select count(*) from table where col::text ~~* '%text%'; > > count > ------- > 1 > (1 row) > > is correct. > > But now if I do: > > > select count(*) from table where col::text !~~* '%text%'; > count > ------- > 98 > (1 row) > > Shouldn't it be 99? That is out of 100 records there is one that has > "text" in column "col" so the !~~* should return 99 rows. ?? Wild guess: select count (*) from table where col is null; count ------ 1 (1 row) ";-) Reinoud -- __________________________________________________ "Nothing is as subjective as reality" Reinoud van Leeuwen reinoud.v@n.leeuwen.net http://reinoud.van.leeuwen.net kvk 27320762 __________________________________________________