Re: it's not NULL, then what is it? - Mailing list pgsql-sql

From Steve Crawford
Subject Re: it's not NULL, then what is it?
Date
Msg-id 4A4A941C.2060604@pinpointresearch.com
Whole thread Raw
In response to it's not NULL, then what is it?  ("Tena Sakai" <tsakai@gallo.ucsf.edu>)
Responses Re: it's not NULL, then what is it?  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-sql
...
>
>
>   canon=# select count(maf) from gallo.sds_seq_reg_shw
>   canon-#  where maf ISNULL;
>    count
>   -------
>        0
>   (1 row)
>
I believe count will only count not-null anyway so this will always 
return zero. Try count(*) instead of count(maf). Here's an example:

steve@[local]=> select * from barr;
LOG:  duration: 0.226 msa | b
---+---a | bc | d  | e
(3 rows)

steve@[local]=> select coalesce(a, 'a is null'), coalesce(b, 'b is 
null') from barr;
LOG:  duration: 0.283 mscoalesce  | coalesce
-----------+----------a         | bc         | da is null | e
(3 rows)

steve@[local]=> select count(a) from barr;
LOG:  duration: 0.339 mscount
-------    2
(1 row)

steve@[local]=> select count(*) from barr where a isnull;
LOG:  duration: 0.350 mscount
-------    1
(1 row)




pgsql-sql by date:

Previous
From: "Edward W. Rouse"
Date:
Subject: Re: it's not NULL, then what is it?
Next
From: Thomas Kellerer
Date:
Subject: Re: it's not NULL, then what is it?