handling of COUNT(record) vs IS NULL

From: Sam Mason <sam(at)samason(dot)me(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: handling of COUNT(record) vs IS NULL
Date: 2008-01-28 15:59:43
Message-ID: 20080128155943.GR18990@frubble.xen.chris-lamb.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've just noticed that the handling of COUNT(record) and (record IS
NULL) aren't consistent with my understanding of them. If I run the
following query:

SELECT
NULL IS NULL, COUNT( NULL ),
(NULL,NULL) IS NULL, COUNT((NULL,NULL));

The IS NULL checks both return TRUE as I'd expect them to, but the
second count doesn't return 0.

The Comparison Operator docs[1] describe the behaviour of IS NULL
changing, with respect to records, in version 8.2. Is count still
exhibiting the old behaviour?

Sam

[1] http://www.postgresql.org/docs/8.2/static/functions-comparison.html

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Harald Fuchs 2008-01-28 16:53:51 Re: Is news.postgresql.org down?
Previous Message Gregory Stark 2008-01-28 15:50:38 Re: A select DISTINCT query? - followup Q