Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d28498

Browse files
committed
Document IS DISTINCT FROM in a more obvious place, and add some more
index entries for IS-foo constructs.
1 parent3b6cc1a commit3d28498

File tree

2 files changed

+86
-9
lines changed

2 files changed

+86
-9
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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 $
33
PostgreSQL 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>&lt;&gt;</> 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 theoperand 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

‎doc/src/sgml/syntax.sgml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.95 2004/09/20 22:48:25 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.96 2004/10/26 22:16:12 tgl Exp $
33
-->
44

55
<chapter id="sql-syntax">
@@ -1421,6 +1421,10 @@ SELECT name, (SELECT max(pop) FROM cities WHERE cities.state = states.name)
14211421
<secondary>constructor</secondary>
14221422
</indexterm>
14231423

1424+
<indexterm>
1425+
<primary>ARRAY</primary>
1426+
</indexterm>
1427+
14241428
<para>
14251429
An array constructor is an expression that builds an
14261430
array value from values for its member elements. A simple array
@@ -1521,13 +1525,17 @@ SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
15211525
<secondary>constructor</secondary>
15221526
</indexterm>
15231527

1528+
<indexterm>
1529+
<primary>ROW</primary>
1530+
</indexterm>
1531+
15241532
<para>
15251533
A row constructor is an expression that builds a row value (also
15261534
called a composite value) from values
15271535
for its member fields. A row constructor consists of the key word
1528-
<literal>ROW</literal>, a left parenthesis <literal>(</>, zero or more
1536+
<literal>ROW</literal>, a left parenthesis, zero or more
15291537
expressions (separated by commas) for the row field values, and finally
1530-
a right parenthesis <literal>)</>. For example,
1538+
a right parenthesis. For example,
15311539
<programlisting>
15321540
SELECT ROW(1,2.5,'this is a test');
15331541
</programlisting>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp