pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
To: pgsql-sql@postgresql.org
Subject: Re: why these results?
Date: Tue, 2 Aug 2011 01:01:09 +0200
Message-ID: <20110801230109.GS18120@spoetnik.xs4all.nl> (raw)
In-Reply-To: <CAFjCMHuntvFO7SsGYNQrDjUwXazfnu5dgYA0BOh4eX0VcABzeA@mail.gmail.com>
References: <CAFjCMHuntvFO7SsGYNQrDjUwXazfnu5dgYA0BOh4eX0VcABzeA@mail.gmail.com>

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
__________________________________________________



view thread (5+ messages)  latest in thread

Message-ID: <20110801230109.GS18120@spoetnik.xs4all.nl>
Permalink:  ../20110801230109.GS18120@spoetnik.xs4all.nl/
Also on:    postgresql.org/message-id/20110801230109.GS18120@spoetnik.xs4all.nl

 · 

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-sql@postgresql.org
  Cc: reinoud.v@n.leeuwen.net
  Subject: Re: why these results?
  In-Reply-To: <20110801230109.GS18120@spoetnik.xs4all.nl>

* 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