Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id B45B39FB527 for ; Mon, 30 Apr 2007 21:03:09 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 54462-06 for ; Mon, 30 Apr 2007 21:03:01 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by postgresql.org (Postfix) with ESMTP id 77B029FB1CA for ; Mon, 30 Apr 2007 21:03:06 -0300 (ADT) Received: by an-out-0708.google.com with SMTP id c24so1543249ana for ; Mon, 30 Apr 2007 17:03:04 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=pPq6vG5XLxd9xKx5uZUDTZsxhFlDfJMS7IdNI7E3ki2ebjeVOb2im5hmpjLRGszPYAy0ThurzEFJWc8AUHMyIn3oidFbHEbbBRBpab4SCSXQEhYlH31voUCa6OSa1S8U2PRJD1x6FUo6yaBmb2Jb1TdQ0WDwABkzFd8SYjlvP40= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=s1EQ1BOdVMB33hgcPCiAj7b39h8cKtQUaX4O9VxqcxGzna22nsT1B23HzjAFDFSQmmioN5xoqvOdfF/MkQgKXF82UoAsZdXx1KBavJEje49jXsq1hNUu3u1nQ8OCNqP6Hx6ToTWGPRujit7+LExSUQ5h7x6Aw4pXCgubFtY59GQ= Received: by 10.114.103.1 with SMTP id a1mr2190977wac.1177977783566; Mon, 30 Apr 2007 17:03:03 -0700 (PDT) Received: by 10.114.37.14 with HTTP; Mon, 30 Apr 2007 17:03:03 -0700 (PDT) Message-ID: Date: Mon, 30 Apr 2007 17:03:03 -0700 From: "Collin Peters" To: pgsql-sql@postgresql.org Subject: "is not distinct from" syntax error? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/279 X-Sequence-Number: 28279 From: http://www.postgresql.org/docs/8.2/static/functions-comparison.html " The ordinary comparison operators yield null (signifying "unknown") when either input is null. Another way to do comparisons is with the IS [ NOT ] DISTINCT FROM construct: expression IS DISTINCT FROM expression expression IS NOT DISTINCT FROM expression For non-null inputs, IS DISTINCT FROM is the same as the <> operator. However, when both inputs are null it will return false, and when just one input is null it will return true. Similarly, IS NOT DISTINCT FROM is identical to = for non-null inputs, but it returns true when both inputs are null, and false when only one input is null. Thus, these constructs effectively act as though null were a normal data value, rather than "unknown"." However, when I do: SELECT 1 IS NOT DISTINCT FROM 2 I get "ERROR: syntax error at or near "DISTINCT"" I can do: SELECT NOT (1 IS DISTINCT FROM 2) What is the problem here? Regards, Collin