public inbox for [email protected]
help / color / mirror / Atom feedFrom: Josh Kupershmidt <[email protected]>
To: Jack Douglas <[email protected]>
Cc: [email protected]
Subject: Re: boolean states
Date: Sun, 1 May 2011 19:07:10 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
On Fri, Apr 29, 2011 at 3:29 AM, Jack Douglas
<[email protected]> wrote:
> NULL is not unique to boolean, but UNKNOWN is - it would surely be wrong to
> have no mention of it at all on this page. This is because the boolean type
> is the only one used to represent truth (or logical) values. One of the
> comments from the link you provided:
>
>> What’s even more interesting is that for BOOLEAN they invented the keyword
>> UNKNOWN and the 2003 standard states “The null value of the boolean data
>> type is equivalent to the Unknown truth value.” So for BOOLEAN (and only
>> BOOLEAN AFAICT) you’re supposed to say WHERE <boolean primary> IS [NOT]
>> UNKNOWN. And in the definition of “literal”, which is supposed to “Specify a
>> non-null value”, “boolean literal” is equated to TRUE, FALSE or UNKNOWN (but
>> the latter is equivalent to a “null value” a few pages later).
Ah, OK - I had forgotten about that SQL syntax. I do agree that this sentence:
| A third state, "unknown", is represented by the SQL null value.
is particularly confusing, suggesting that "unknown" is a valid
boolean literal, on equal footing with "true" and "false".
We do document the use of IS [NOT] UNKNOWN already, see:
<http://www.postgresql.org/docs/current/interactive/functions-comparison.html;
and IMO that page is the appropriate place for such discussion. So
maybe we just need a link to that page, and should strip out the
confusing sentence about "third state" entirely? Patch attached.
Josh
Attachments:
[application/octet-stream] boolean_unknown.patch (955B, 2-boolean_unknown.patch)
download | inline diff:
diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index bc1ec3f..b838ee1 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -2784,10 +2784,10 @@ P <optional> <replaceable>years</>-<replaceable>months</>-<replaceable>days</> <
<productname>PostgreSQL</productname> provides the
standard <acronym>SQL</acronym> type <type>boolean</type>;
see <xref linkend="datatype-boolean-table">.
- The <type>boolean</type> type can have one of only two states:
- <quote>true</quote> or <quote>false</quote>. A third state,
- <quote>unknown</quote>, is represented by the
- <acronym>SQL</acronym> null value.
+ A non-NULL <type>boolean</type> type can have one of only two states:
+ <quote>true</quote> or <quote>false</quote>. For a list of
+ operators to use with boolean expressions, see
+ <xref linkend="functions-comparison">.
</para>
<table id="datatype-boolean-table">
view thread (10+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: boolean states
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox