11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.200 2004/05/10 21:08:28 neilc Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.201 2004/05/10 22:44:42 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -7822,13 +7822,15 @@ SELECT col1 FROM tab1
78227822 </para>
78237823
78247824<synopsis>
7825- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) IN (<replaceable>subquery</replaceable>)
7825+ <replaceable>row_constructor </replaceable> IN (<replaceable>subquery</replaceable>)
78267826</synopsis>
78277827
78287828 <para>
7829- The right-hand side of this form of <token>IN</token> is a parenthesized
7829+ The left-hand side of this form of <token>IN</token> is a row constructor,
7830+ as described in <xref linkend="sql-syntax-row-constructors">.
7831+ The right-hand side is a parenthesized
78307832 subquery, which must return exactly as many columns as there are
7831- expressions in the left-hand list . The left-hand expressions are
7833+ expressions in the left-hand row . The left-hand expressions are
78327834 evaluated and compared row-wise to each row of the subquery result.
78337835 The result of <token>IN</token> is <quote>true</> if any equal subquery row is found.
78347836 The result is <quote>false</> if no equal row is found (including the special
@@ -7876,13 +7878,15 @@ SELECT col1 FROM tab1
78767878 </para>
78777879
78787880<synopsis>
7879- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) NOT IN (<replaceable>subquery</replaceable>)
7881+ <replaceable>row_constructor </replaceable> NOT IN (<replaceable>subquery</replaceable>)
78807882</synopsis>
78817883
78827884 <para>
7883- The right-hand side of this form of <token>NOT IN</token> is a parenthesized
7885+ The left-hand side of this form of <token>NOT IN</token> is a row constructor,
7886+ as described in <xref linkend="sql-syntax-row-constructors">.
7887+ The right-hand side is a parenthesized
78847888 subquery, which must return exactly as many columns as there are
7885- expressions in the left-hand list . The left-hand expressions are
7889+ expressions in the left-hand row . The left-hand expressions are
78867890 evaluated and compared row-wise to each row of the subquery result.
78877891 The result of <token>NOT IN</token> is <quote>true</> if only unequal subquery rows
78887892 are found (including the special case where the subquery returns no rows).
@@ -7938,14 +7942,16 @@ SELECT col1 FROM tab1
79387942 </para>
79397943
79407944<synopsis>
7941- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</> ANY (<replaceable>subquery</replaceable>)
7942- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</> SOME (<replaceable>subquery</replaceable>)
7945+ <replaceable>row_constructor </replaceable> <replaceable>operator</> ANY (<replaceable>subquery</replaceable>)
7946+ <replaceable>row_constructor </replaceable> <replaceable>operator</> SOME (<replaceable>subquery</replaceable>)
79437947</synopsis>
79447948
79457949 <para>
7946- The right-hand side of this form of <token>ANY</token> is a parenthesized
7950+ The left-hand side of this form of <token>ANY</token> is a row constructor,
7951+ as described in <xref linkend="sql-syntax-row-constructors">.
7952+ The right-hand side is a parenthesized
79477953 subquery, which must return exactly as many columns as there are
7948- expressions in the left-hand list . The left-hand expressions are
7954+ expressions in the left-hand row . The left-hand expressions are
79497955 evaluated and compared row-wise to each row of the subquery result,
79507956 using the given <replaceable>operator</replaceable>. Presently,
79517957 only <literal>=</literal> and <literal><></literal> operators are allowed
@@ -8003,13 +8009,15 @@ SELECT col1 FROM tab1
80038009 </para>
80048010
80058011<synopsis>
8006- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</replaceable> ALL (<replaceable>subquery</replaceable>)
8012+ <replaceable>row_constructor </replaceable> <replaceable>operator</replaceable> ALL (<replaceable>subquery</replaceable>)
80078013</synopsis>
80088014
80098015 <para>
8010- The right-hand side of this form of <token>ALL</token> is a parenthesized
8016+ The left-hand side of this form of <token>ALL</token> is a row constructor,
8017+ as described in <xref linkend="sql-syntax-row-constructors">.
8018+ The right-hand side is a parenthesized
80118019 subquery, which must return exactly as many columns as there are
8012- expressions in the left-hand list . The left-hand expressions are
8020+ expressions in the left-hand row . The left-hand expressions are
80138021 evaluated and compared row-wise to each row of the subquery result,
80148022 using the given <replaceable>operator</replaceable>. Presently,
80158023 only <literal>=</literal> and <literal><></literal> operators are allowed
@@ -8041,16 +8049,17 @@ SELECT col1 FROM tab1
80418049 </indexterm>
80428050
80438051<synopsis>
8044- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) <replaceable>operator</replaceable> (<replaceable>subquery</replaceable>)
8052+ <replaceable>row_constructor </replaceable> <replaceable>operator</replaceable> (<replaceable>subquery</replaceable>)
80458053</synopsis>
80468054
80478055 <para>
8048- The left-hand side is a list of scalar expressions. The right-hand side is
8049- a parenthesized subquery, which must return exactly as many columns as there
8050- are expressions on the left-hand side. Furthermore, the subquery cannot
8051- return more than one row. (If it returns zero rows, the result is taken to
8052- be null.) The left-hand side is evaluated and compared row-wise to the
8053- single subquery result row.
8056+ The left-hand side is a row constructor,
8057+ as described in <xref linkend="sql-syntax-row-constructors">.
8058+ The right-hand side is a parenthesized subquery, which must return exactly
8059+ as many columns as there are expressions in the left-hand row. Furthermore,
8060+ the subquery cannot return more than one row. (If it returns zero rows,
8061+ the result is taken to be null.) The left-hand side is evaluated and
8062+ compared row-wise to the single subquery result row.
80548063 Presently, only <literal>=</literal> and <literal><></literal> operators are allowed
80558064 in row-wise comparisons.
80568065 The result is <quote>true</> if the two rows are equal or unequal, respectively.
@@ -8223,13 +8232,14 @@ AND
82238232 <title>Row-wise Comparison</title>
82248233
82258234<synopsis>
8226- ( <replaceable>expression </replaceable> <optional>, < replaceable>expression</replaceable> ...</optional>) <replaceable> operator</replaceable> ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>)
8235+ <replaceable>row_constructor </replaceable> <replaceable>operator</replaceable> <replaceable>row_constructor </replaceable>
82278236</synopsis>
82288237
82298238 <para>
8230- Each side is a list of scalar expressions; the two lists must be
8231- of the same length. Each side is evaluated and they are compared
8232- row-wise.
8239+ Each side is a row constructor,
8240+ as described in <xref linkend="sql-syntax-row-constructors">.
8241+ The two row values must have the same number of fields.
8242+ Each side is evaluated and they are compared row-wise.
82338243 Presently, only <literal>=</literal> and <literal><></literal> operators are allowed
82348244 in row-wise comparisons.
82358245 The result is <quote>true</> if the two rows are equal or unequal, respectively.
@@ -8242,6 +8252,29 @@ AND
82428252 are unequal if any corresponding members are non-null and unequal;
82438253 otherwise the result of the row comparison is unknown (null).
82448254 </para>
8255+
8256+ <synopsis>
8257+ <replaceable>row_constructor</replaceable> IS DISTINCT FROM <replaceable>row_constructor</replaceable>
8258+ </synopsis>
8259+
8260+ <para>
8261+ This construct is similar to a <literal><></literal> row comparison,
8262+ but it does not yield null for null inputs. Instead, any null value is
8263+ considered unequal to (distinct from) any non-null value, and any two
8264+ nulls are considered equal (not distinct). Thus the result will always
8265+ be either true or false, never null.
8266+ </para>
8267+
8268+ <synopsis>
8269+ <replaceable>row_constructor</replaceable> IS NULL
8270+ <replaceable>row_constructor</replaceable> IS NOT NULL
8271+ </synopsis>
8272+
8273+ <para>
8274+ These constructs test a row value for null or not null. A row value
8275+ is considered not null if it has at least one field that is not null.
8276+ </para>
8277+
82458278 </sect2>
82468279 </sect1>
82478280
0 commit comments