11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.220 2004/10/04 08:15:41 neilc Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.221 2004/10/26 22:16:11 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -283,6 +283,18 @@ PostgreSQL documentation
283283 </para>
284284
285285 <para>
286+ <indexterm>
287+ <primary>IS NULL</primary>
288+ </indexterm>
289+ <indexterm>
290+ <primary>IS NOT NULL</primary>
291+ </indexterm>
292+ <indexterm>
293+ <primary>ISNULL</primary>
294+ </indexterm>
295+ <indexterm>
296+ <primary>NOTNULL</primary>
297+ </indexterm>
286298 To check whether a value is or is not null, use the constructs
287299<synopsis>
288300<replaceable>expression</replaceable> IS NULL
@@ -305,6 +317,7 @@ PostgreSQL documentation
305317 behavior conforms to the SQL standard.
306318 </para>
307319
320+ <tip>
308321 <para>
309322 Some applications may expect that
310323 <literal><replaceable>expression</replaceable> = NULL</literal>
@@ -318,8 +331,43 @@ PostgreSQL documentation
318331 the default behavior in <productname>PostgreSQL</productname>
319332 releases 6.5 through 7.1.
320333 </para>
334+ </tip>
335+
336+ <para>
337+ <indexterm>
338+ <primary>IS DISTINCT FROM</primary>
339+ </indexterm>
340+ The ordinary comparison operators yield null (signifying <quote>unknown</>)
341+ when either input is null. Another way to do comparisons is with the
342+ <literal>IS DISTINCT FROM</literal> construct:
343+ <synopsis>
344+ <replaceable>expression</replaceable> IS DISTINCT FROM <replaceable>expression</replaceable>
345+ </synopsis>
346+ For non-null inputs this is the same as the <literal><></> operator.
347+ However, when both inputs are null it will return false, and when just
348+ one input is null it will return true. Thus it effectively acts as though
349+ null were a normal data value, rather than <quote>unknown</>.
350+ </para>
321351
322352 <para>
353+ <indexterm>
354+ <primary>IS TRUE</primary>
355+ </indexterm>
356+ <indexterm>
357+ <primary>IS NOT TRUE</primary>
358+ </indexterm>
359+ <indexterm>
360+ <primary>IS FALSE</primary>
361+ </indexterm>
362+ <indexterm>
363+ <primary>IS NOT FALSE</primary>
364+ </indexterm>
365+ <indexterm>
366+ <primary>IS UNKNOWN</primary>
367+ </indexterm>
368+ <indexterm>
369+ <primary>IS NOT UNKNOWN</primary>
370+ </indexterm>
323371 Boolean values can also be tested using the constructs
324372<synopsis>
325373<replaceable>expression</replaceable> IS TRUE
@@ -329,9 +377,13 @@ PostgreSQL documentation
329377<replaceable>expression</replaceable> IS UNKNOWN
330378<replaceable>expression</replaceable> IS NOT UNKNOWN
331379</synopsis>
332- Theseare similar to <literal>IS NULL</literal> in that they will
333- always return true or false, never a null value, even when the operand is null.
380+ Thesewill always return true or false, never a null value, even when the
381+ operand is null.
334382 A null input is treated as the logical value <quote>unknown</>.
383+ Notice that <literal>IS UNKNOWN</> and <literal>IS NOT UNKNOWN</> are
384+ effectively the same as <literal>IS NULL</literal> and
385+ <literal>IS NOT NULL</literal>, respectively, except that the input
386+ expression must be of Boolean type.
335387 </para>
336388 </sect1>
337389
@@ -7344,7 +7396,7 @@ SELECT col1 FROM tab1
73447396 </sect2>
73457397
73467398 <sect2>
7347- <title><literal>NOT IN </literal></title>
7399+ <title><literal>NOT IN</literal></title>
73487400
73497401<synopsis>
73507402<replaceable>expression</replaceable> NOT IN (<replaceable>subquery</replaceable>)
@@ -7538,9 +7590,9 @@ SELECT col1 FROM tab1
75387590 <sect2>
75397591 <title>Row-wise Comparison</title>
75407592
7541- <indexterm>
7593+ <indexterm zone="functions-subquery" >
75427594 <primary>comparison</primary>
7543- <secondary>of rows </secondary>
7595+ <secondary>subquery result row </secondary>
75447596 </indexterm>
75457597
75467598<synopsis>
@@ -7594,6 +7646,23 @@ SELECT col1 FROM tab1
75947646 <primary>SOME</primary>
75957647 </indexterm>
75967648
7649+ <indexterm>
7650+ <primary>comparison</primary>
7651+ <secondary>row-wise</secondary>
7652+ </indexterm>
7653+
7654+ <indexterm>
7655+ <primary>IS DISTINCT FROM</primary>
7656+ </indexterm>
7657+
7658+ <indexterm>
7659+ <primary>IS NULL</primary>
7660+ </indexterm>
7661+
7662+ <indexterm>
7663+ <primary>IS NOT NULL</primary>
7664+ </indexterm>
7665+
75977666 <para>
75987667 This section describes several specialized constructs for making
75997668 multiple comparisons between groups of values. These forms are