From: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
---|---|
To: | Fernando Schapachnik <fernando(at)mecon(dot)gov(dot)ar> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Optimizer problem in 8.1.6 |
Date: | 2007-06-22 16:21:48 |
Message-ID: | 3C6C435F-C850-4814-BCDF-3D2B731DADD9@seespotcode.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Jun 22, 2007, at 10:16 , Fernando Schapachnik wrote:
> Maybe this is already solved in more advanced releases, but just in
> case.
>
> VIEW active_users:
> SELECT * FROM users WHERE active AND ((field IS NULL) OR (NOT field));
You could also rewrite this as
SELECT *
FROM users
WHERE active
AND field IS NOT TRUE;
IS NOT TRUE returns true for false and null:
SELECT true IS NOT TRUE AS "true"
, false IS NOT TRUE AS "false"
, null IS NOT TRUE AS "null";
true | false | null
------+-------+------
f | t | t
This might be a little easier to read.
Michael Glaesemann
grzm seespotcode net
From | Date | Subject | |
---|---|---|---|
Next Message | Tzahi Fadida | 2007-06-22 16:38:01 | Re: 8.2 contrib. "Full Disjunction" |
Previous Message | Michael Glaesemann | 2007-06-22 16:10:39 | Re: Optimizer problem in 8.1.6 |