Re: null answer - how? - Mailing list pgsql-general

From Stephan Szabo
Subject Re: null answer - how?
Date
Msg-id Pine.BSF.4.21.0109191130380.68729-100000@megazone23.bigpanda.com
Whole thread Raw
In response to null answer - how?  (Patrick Welche <prlw1@newn.cam.ac.uk>)
Responses Re: null answer - how?
List pgsql-general
On Wed, 19 Sep 2001, Patrick Welche wrote:

> select coalesce(sum(deltafromoctets),0)
>   from trans,stats
>  where stats_id=stats.id
>    and (timeslicet < '1:05' OR timeslicet > '6:05')
>
> returns a number (9188191930), whereas
>
> select coalesce(sum(deltafromoctets),0)
>   from trans,stats
>  where stats_id=stats.id
>    and (timeslicet < '1:05' OR timeslicet > '6:05')
>    and timesliced < '01-May-2001'
>
> prints 0 (or null without the coalesce) as does
>
> select coalesce(sum(deltafromoctets),0)
>   from trans,stats
>  where stats_id=stats.id
>    and timesliced < '01-May-2001'
>
> How can this be?
>
> select * from stats where timesliced is null or timeslicet is null
> select * from trans where deltafromoctets is null
>
> both retun 0 rows.

Are there no rows with timesliced<'01-May-2001'?  I think in that
case sum() gives you one row with NULL.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Messages
Next
From: Martín Marqués
Date:
Subject: multi-byte