<!--
-$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.220 2004/10/04 08:15:41 neilc Exp $
+$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.221 2004/10/26 22:16:11 tgl Exp $
PostgreSQL documentation
-->
</para>
<para>
+ <indexterm>
+ <primary>IS NULL</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS NOT NULL</primary>
+ </indexterm>
+ <indexterm>
+ <primary>ISNULL</primary>
+ </indexterm>
+ <indexterm>
+ <primary>NOTNULL</primary>
+ </indexterm>
To check whether a value is or is not null, use the constructs
<synopsis>
<replaceable>expression</replaceable> IS NULL
behavior conforms to the SQL standard.
</para>
+ <tip>
<para>
Some applications may expect that
<literal><replaceable>expression</replaceable> = NULL</literal>
the default behavior in <productname>PostgreSQL</productname>
releases 6.5 through 7.1.
</para>
+ </tip>
+
+ <para>
+ <indexterm>
+ <primary>IS DISTINCT FROM</primary>
+ </indexterm>
+ The ordinary comparison operators yield null (signifying <quote>unknown</>)
+ when either input is null. Another way to do comparisons is with the
+ <literal>IS DISTINCT FROM</literal> construct:
+<synopsis>
+<replaceable>expression</replaceable> IS DISTINCT FROM <replaceable>expression</replaceable>
+</synopsis>
+ For non-null inputs this is the same as the <literal><></> operator.
+ However, when both inputs are null it will return false, and when just
+ one input is null it will return true. Thus it effectively acts as though
+ null were a normal data value, rather than <quote>unknown</>.
+ </para>
<para>
+ <indexterm>
+ <primary>IS TRUE</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS NOT TRUE</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS FALSE</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS NOT FALSE</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS UNKNOWN</primary>
+ </indexterm>
+ <indexterm>
+ <primary>IS NOT UNKNOWN</primary>
+ </indexterm>
Boolean values can also be tested using the constructs
<synopsis>
<replaceable>expression</replaceable> IS TRUE
<replaceable>expression</replaceable> IS UNKNOWN
<replaceable>expression</replaceable> IS NOT UNKNOWN
</synopsis>
- These are similar to <literal>IS NULL</literal> in that they will
- always return true or false, never a null value, even when the operand is null.
+ These will always return true or false, never a null value, even when the
+ operand is null.
A null input is treated as the logical value <quote>unknown</>.
+ Notice that <literal>IS UNKNOWN</> and <literal>IS NOT UNKNOWN</> are
+ effectively the same as <literal>IS NULL</literal> and
+ <literal>IS NOT NULL</literal>, respectively, except that the input
+ expression must be of Boolean type.
</para>
</sect1>
</sect2>
<sect2>
- <title><literal>NOT IN </literal></title>
+ <title><literal>NOT IN</literal></title>
<synopsis>
<replaceable>expression</replaceable> NOT IN (<replaceable>subquery</replaceable>)
<sect2>
<title>Row-wise Comparison</title>
- <indexterm>
+ <indexterm zone="functions-subquery">
<primary>comparison</primary>
- <secondary>of rows</secondary>
+ <secondary>subquery result row</secondary>
</indexterm>
<synopsis>
<primary>SOME</primary>
</indexterm>
+ <indexterm>
+ <primary>comparison</primary>
+ <secondary>row-wise</secondary>
+ </indexterm>
+
+ <indexterm>
+ <primary>IS DISTINCT FROM</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>IS NULL</primary>
+ </indexterm>
+
+ <indexterm>
+ <primary>IS NOT NULL</primary>
+ </indexterm>
+
<para>
This section describes several specialized constructs for making
multiple comparisons between groups of values. These forms are
<!--
-$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.95 2004/09/20 22:48:25 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.96 2004/10/26 22:16:12 tgl Exp $
-->
<chapter id="sql-syntax">
<secondary>constructor</secondary>
</indexterm>
+ <indexterm>
+ <primary>ARRAY</primary>
+ </indexterm>
+
<para>
An array constructor is an expression that builds an
array value from values for its member elements. A simple array
<secondary>constructor</secondary>
</indexterm>
+ <indexterm>
+ <primary>ROW</primary>
+ </indexterm>
+
<para>
A row constructor is an expression that builds a row value (also
called a composite value) from values
for its member fields. A row constructor consists of the key word
- <literal>ROW</literal>, a left parenthesis <literal>(</>, zero or more
+ <literal>ROW</literal>, a left parenthesis, zero or more
expressions (separated by commas) for the row field values, and finally
- a right parenthesis <literal>)</>. For example,
+ a right parenthesis. For example,
<programlisting>
SELECT ROW(1,2.5,'this is a test');
</programlisting>