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

Commitbd86407

Browse files
committed
doc: move ROW IS NULL examples to a different chapter
Also add examples.Reported-by: Wolfgang WaltherDiscussion:https://postgr.es/m/21ff8e9c-627a-f949-fb00-a41b9ddcc9d3@technowledgy.deBackpatch-through: master
1 parent8680bae commitbd86407

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,19 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
718718
<literal>IS NULL</literal> and <literal>IS NOT NULL</literal> do not always return
719719
inverse results for row-valued expressions; in particular, a row-valued
720720
expression that contains both null and non-null fields will return false
721-
for both tests. In some cases, it may be preferable to
721+
for both tests. For example:
722+
723+
<programlisting>
724+
SELECT ROW(1,2.5,'this is a test') = ROW(1, 3, 'not the same');
725+
726+
SELECT ROW(table.*) IS NULL FROM table; -- detect all-null rows
727+
728+
SELECT ROW(table.*) IS NOT NULL FROM table; -- detect all-non-null rows
729+
730+
SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in rows
731+
</programlisting>
732+
733+
In some cases, it may be preferable to
722734
write <replaceable>row</replaceable> <literal>IS DISTINCT FROM NULL</literal>
723735
or <replaceable>row</replaceable> <literal>IS NOT DISTINCT FROM NULL</literal>,
724736
which will simply check whether the overall row value is null without any

‎doc/src/sgml/syntax.sgml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,17 +2479,12 @@ SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype));
24792479
<para>
24802480
Row constructors can be used to build composite values to be stored
24812481
in a composite-type table column, or to be passed to a function that
2482-
accepts a composite parameter. Also,
2483-
it is possible to compare two row values or test a row with
2484-
<literal>IS NULL</literal> or <literal>IS NOT NULL</literal>, for example:
2485-
<programlisting>
2486-
SELECT ROW(1,2.5,'this is a test') = ROW(1, 3, 'not the same');
2487-
2488-
SELECT ROW(table.*) IS NULL FROM table; -- detect all-null rows
2489-
</programlisting>
2490-
For more detail see <xref linkend="functions-comparisons"/>.
2491-
Row constructors can also be used in connection with subqueries,
2492-
as discussed in <xref linkend="functions-subquery"/>.
2482+
accepts a composite parameter. Also, it is possible to test rows
2483+
using the standard comparison operators as described in <xref
2484+
linkend="functions-comparison"/>, to compare one row against another
2485+
as described in <xref linkend="functions-comparisons"/>, and to
2486+
use them in connection with subqueries, as discussed in <xref
2487+
linkend="functions-subquery"/>,
24932488
</para>
24942489

24952490
</sect2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp