From: | "Collin Peters" <cadiolis(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | "is not distinct from" syntax error? |
Date: | 2007-05-01 00:03:03 |
Message-ID: | df01c91b0704301703y2eca1537iced07037e2f1c469@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-05-01 00:46:57 | Re: "is not distinct from" syntax error? |
Previous Message | Collin Peters | 2007-04-30 23:58:54 | Dynamic prepare possible in plpgsql? |