Re: Query about Boolean Data Type - Mailing list pgsql-novice

From Tom Lane
Subject Re: Query about Boolean Data Type
Date
Msg-id 5575.1060441632@sss.pgh.pa.us
Whole thread Raw
In response to Query about Boolean Data Type  ("Richard Hurst" <richard.hurst@kirklees.gov.uk>)
List pgsql-novice
"Richard Hurst" <richard.hurst@kirklees.gov.uk> writes:
> This may seem a bit simplistic but how do you match a select on a
> boolean data column where the entry is false or null

Slick way:
        ... WHERE foo IS NOT TRUE;
Straightforward way:
        ... WHERE (NOT foo) OR (foo IS NULL);
or
        ... WHERE (foo = false) OR (foo IS NULL);
but not
        ... WHERE (foo = false) OR (foo = NULL);
The last will not do what you expect.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: CURRENT TIME causes server to shutdown connection
Next
From: Stephane Pinel
Date:
Subject: Auto_Increment