pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
"is not distinct from" syntax error? 2+ messages / 2 participants [nested] [flat]
* "is not distinct from" syntax error? @ 2007-05-01 00:03 Collin Peters <cadiolis@gmail.com> 2007-05-01 00:46 ` Re: "is not distinct from" syntax error? Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 2+ messages in thread From: Collin Peters @ 2007-05-01 00:03 UTC (permalink / raw) To: 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 ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: "is not distinct from" syntax error? 2007-05-01 00:03 "is not distinct from" syntax error? Collin Peters <cadiolis@gmail.com> @ 2007-05-01 00:46 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 2+ messages in thread From: Tom Lane @ 2007-05-01 00:46 UTC (permalink / raw) To: Collin Peters <cadiolis@gmail.com>; +Cc: pgsql-sql "Collin Peters" <cadiolis@gmail.com> writes: > However, when I do: > SELECT 1 IS NOT DISTINCT FROM 2 > I get "ERROR: syntax error at or near "DISTINCT"" > What is the problem here? Using a pre-8.2 server, likely. regards, tom lane ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-05-01 00:46 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2007-05-01 00:03 "is not distinct from" syntax error? Collin Peters <cadiolis@gmail.com> 2007-05-01 00:46 ` Tom Lane <tgl@sss.pgh.pa.us>
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