pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Collin Peters <cadiolis@gmail.com>
To: pgsql-sql@postgresql.org
Subject: "is not distinct from" syntax error?
Date: Mon, 30 Apr 2007 17:03:03 -0700
Message-ID: <df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com>
Permalink:  ../df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com/
Also on:    postgresql.org/message-id/df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com

 · 

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: pgsql-sql@postgresql.org
  Cc: cadiolis@gmail.com
  Subject: Re: "is not distinct from" syntax error?
  In-Reply-To: <df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox