Re: why these results?

From: Reinoud van Leeuwen <reinoud(dot)v(at)n(dot)leeuwen(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: why these results?
Date: 2011-08-01 23:01:09
Message-ID: 20110801230109.GS18120@spoetnik.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(dot)v(at)n(dot)leeuwen(dot)net
http://reinoud.van.leeuwen.net kvk 27320762
__________________________________________________

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Crawford 2011-08-01 23:01:30 Re: why these results?
Previous Message Adrian Klaver 2011-08-01 23:00:31 Re: why these results?