1
1
<!--
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 $
3
3
PostgreSQL documentation
4
4
-->
5
5
@@ -7822,13 +7822,15 @@ SELECT col1 FROM tab1
7822
7822
</para>
7823
7823
7824
7824
<synopsis>
7825
- ( <replaceable>expression </replaceable> <optional>, <replaceable>expression</replaceable> ...</optional>) IN (<replaceable>subquery</replaceable>)
7825
+ <replaceable>row_constructor </replaceable> IN (<replaceable>subquery</replaceable>)
7826
7826
</synopsis>
7827
7827
7828
7828
<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
7830
7832
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
7832
7834
evaluated and compared row-wise to each row of the subquery result.
7833
7835
The result of <token>IN</token> is <quote>true</> if any equal subquery row is found.
7834
7836
The result is <quote>false</> if no equal row is found (including the special
@@ -7876,13 +7878,15 @@ SELECT col1 FROM tab1
7876
7878
</para>
7877
7879
7878
7880
<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>)
7880
7882
</synopsis>
7881
7883
7882
7884
<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
7884
7888
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
7886
7890
evaluated and compared row-wise to each row of the subquery result.
7887
7891
The result of <token>NOT IN</token> is <quote>true</> if only unequal subquery rows
7888
7892
are found (including the special case where the subquery returns no rows).
@@ -7938,14 +7942,16 @@ SELECT col1 FROM tab1
7938
7942
</para>
7939
7943
7940
7944
<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>)
7943
7947
</synopsis>
7944
7948
7945
7949
<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
7947
7953
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
7949
7955
evaluated and compared row-wise to each row of the subquery result,
7950
7956
using the given <replaceable>operator</replaceable>. Presently,
7951
7957
only <literal>=</literal> and <literal><></literal> operators are allowed
@@ -8003,13 +8009,15 @@ SELECT col1 FROM tab1
8003
8009
</para>
8004
8010
8005
8011
<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>)
8007
8013
</synopsis>
8008
8014
8009
8015
<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
8011
8019
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
8013
8021
evaluated and compared row-wise to each row of the subquery result,
8014
8022
using the given <replaceable>operator</replaceable>. Presently,
8015
8023
only <literal>=</literal> and <literal><></literal> operators are allowed
@@ -8041,16 +8049,17 @@ SELECT col1 FROM tab1
8041
8049
</indexterm>
8042
8050
8043
8051
<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>)
8045
8053
</synopsis>
8046
8054
8047
8055
<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.
8054
8063
Presently, only <literal>=</literal> and <literal><></literal> operators are allowed
8055
8064
in row-wise comparisons.
8056
8065
The result is <quote>true</> if the two rows are equal or unequal, respectively.
@@ -8223,13 +8232,14 @@ AND
8223
8232
<title>Row-wise Comparison</title>
8224
8233
8225
8234
<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>
8227
8236
</synopsis>
8228
8237
8229
8238
<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.
8233
8243
Presently, only <literal>=</literal> and <literal><></literal> operators are allowed
8234
8244
in row-wise comparisons.
8235
8245
The result is <quote>true</> if the two rows are equal or unequal, respectively.
@@ -8242,6 +8252,29 @@ AND
8242
8252
are unequal if any corresponding members are non-null and unequal;
8243
8253
otherwise the result of the row comparison is unknown (null).
8244
8254
</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
+
8245
8278
</sect2>
8246
8279
</sect1>
8247
8280
0 commit comments