Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A143F133798E for ; Sun, 1 May 2011 20:07:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 92991-06 for ; Sun, 1 May 2011 23:07:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mail.postgresql.org (Postfix) with ESMTP id E0F901336FA7 for ; Sun, 1 May 2011 20:07:30 -0300 (ADT) Received: by wwc33 with SMTP id 33so5076460wwc.19 for ; Sun, 01 May 2011 16:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=r0Iul/HQ+MXSO6c7QYYNgo8m7IX3PiHeNi5Ya78tYC0=; b=Hm+3cq1JZzvl6wGPgwK//vypyIh/vQhjSMB2+a+k+pjlOKEmC90jgpjIfUt2ccYgPQ x4Usub7a+5hkLQJ2anLgkRX4TwOykGACuthGIbVozg9VqZ+LAsee22S7eVggFN6pfa2O CZYZZZs9R9Zd3ul9yXnxGO5W82oi66a9YF/q8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=erhtMt8svYPHZtR7JMkXvGUoyVBxSV694mtkZMLr0C+nI0WKPD5iaqPH7mEGtYzgSI K3QZwLDEJZPO+vsQsfr7Sq5IwgpgwjiqcjOmB3Ev3QskXjmfX2a2V3EyIW/wlfR4Xblf 1buMTMbyophTOKJLkWDFLpfsdJd3DI9VOVOe8= Received: by 10.216.237.159 with SMTP id y31mr2281266weq.41.1304291250103; Sun, 01 May 2011 16:07:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.121.15 with HTTP; Sun, 1 May 2011 16:07:10 -0700 (PDT) In-Reply-To: <4DBA68E9.5090302@douglastechnology.co.uk> References: <4DB7D7E3.6010403@douglastechnology.co.uk> <4DBA68E9.5090302@douglastechnology.co.uk> From: Josh Kupershmidt Date: Sun, 1 May 2011 19:07:10 -0400 Message-ID: Subject: Re: boolean states To: Jack Douglas Cc: pgsql-docs@postgresql.org Content-Type: multipart/mixed; boundary=000e0cd51872a5654004a23ef850 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/1 X-Sequence-Number: 6676 --000e0cd51872a5654004a23ef850 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Fri, Apr 29, 2011 at 3:29 AM, Jack Douglas 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 ty= pe > is the only one used to represent truth (or logical) values. One of the > comments from the link you provided: > >> What=92s even more interesting is that for BOOLEAN they invented the key= word >> UNKNOWN and the 2003 standard states =93The null value of the boolean da= ta >> type is equivalent to the Unknown truth value.=94 So for BOOLEAN (and on= ly >> BOOLEAN AFAICT) you=92re supposed to say WHERE IS [NOT= ] >> UNKNOWN. And in the definition of =93literal=94, which is supposed to = =93Specify a >> non-null value=94, =93boolean literal=94 is equated to TRUE, FALSE or UN= KNOWN (but >> the latter is equivalent to a =93null value=94 a few pages later). Ah, OK - I had forgotten about that SQL syntax. I do agree that this senten= ce: | 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: 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 --000e0cd51872a5654004a23ef850 Content-Type: application/octet-stream; name="boolean_unknown.patch" Content-Disposition: attachment; filename="boolean_unknown.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gn6jon0q0 ZGlmZiAtLWdpdCBhL2RvYy9zcmMvc2dtbC9kYXRhdHlwZS5zZ21sIGIvZG9jL3NyYy9zZ21sL2Rh dGF0eXBlLnNnbWwKaW5kZXggYmMxZWMzZi4uYjgzOGVlMSAxMDA2NDQKLS0tIGEvZG9jL3NyYy9z Z21sL2RhdGF0eXBlLnNnbWwKKysrIGIvZG9jL3NyYy9zZ21sL2RhdGF0eXBlLnNnbWwKQEAgLTI3 ODQsMTAgKzI3ODQsMTAgQEAgUCA8b3B0aW9uYWw+IDxyZXBsYWNlYWJsZT55ZWFyczwvPi08cmVw bGFjZWFibGU+bW9udGhzPC8+LTxyZXBsYWNlYWJsZT5kYXlzPC8+IDwKICAgICA8cHJvZHVjdG5h bWU+UG9zdGdyZVNRTDwvcHJvZHVjdG5hbWU+IHByb3ZpZGVzIHRoZQogICAgIHN0YW5kYXJkIDxh Y3JvbnltPlNRTDwvYWNyb255bT4gdHlwZSA8dHlwZT5ib29sZWFuPC90eXBlPjsKICAgICBzZWUg PHhyZWYgbGlua2VuZD0iZGF0YXR5cGUtYm9vbGVhbi10YWJsZSI+LgotICAgIFRoZSA8dHlwZT5i b29sZWFuPC90eXBlPiB0eXBlIGNhbiBoYXZlIG9uZSBvZiBvbmx5IHR3byBzdGF0ZXM6Ci0gICAg PHF1b3RlPnRydWU8L3F1b3RlPiBvciA8cXVvdGU+ZmFsc2U8L3F1b3RlPi4gIEEgdGhpcmQgc3Rh dGUsCi0gICAgPHF1b3RlPnVua25vd248L3F1b3RlPiwgaXMgcmVwcmVzZW50ZWQgYnkgdGhlCi0g ICAgPGFjcm9ueW0+U1FMPC9hY3JvbnltPiBudWxsIHZhbHVlLgorICAgIEEgbm9uLU5VTEwgPHR5 cGU+Ym9vbGVhbjwvdHlwZT4gdHlwZSBjYW4gaGF2ZSBvbmUgb2Ygb25seSB0d28gc3RhdGVzOgor ICAgIDxxdW90ZT50cnVlPC9xdW90ZT4gb3IgPHF1b3RlPmZhbHNlPC9xdW90ZT4uIEZvciBhIGxp c3Qgb2YKKyAgICBvcGVyYXRvcnMgdG8gdXNlIHdpdGggYm9vbGVhbiBleHByZXNzaW9ucywgc2Vl IAorICAgIDx4cmVmIGxpbmtlbmQ9ImZ1bmN0aW9ucy1jb21wYXJpc29uIj4uCiAgICA8L3BhcmE+ CiAKICAgIDx0YWJsZSBpZD0iZGF0YXR5cGUtYm9vbGVhbi10YWJsZSI+Cg== --000e0cd51872a5654004a23ef850--