diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d963f0a0a0..92843b2abb 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -718,7 +718,19 @@ repeat('Pg', 4) PgPgPgPg IS NULL and IS NOT NULL do not always return inverse results for row-valued expressions; in particular, a row-valued expression that contains both null and non-null fields will return false - for both tests. In some cases, it may be preferable to + for both tests. For example: + + +SELECT ROW(1,2.5,'this is a test') = ROW(1, 3, 'not the same'); + +SELECT ROW(table.*) IS NULL FROM table; -- detect all-null rows + +SELECT ROW(table.*) IS NOT NULL FROM table; -- detect all-non-null rows + +SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in rows + + + In some cases, it may be preferable to write row IS DISTINCT FROM NULL or row IS NOT DISTINCT FROM NULL, which will simply check whether the overall row value is null without any diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 9cee925a48..37817d0638 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -2479,17 +2479,12 @@ SELECT getf1(CAST(ROW(11,'this is a test',2.5) AS myrowtype)); Row constructors can be used to build composite values to be stored in a composite-type table column, or to be passed to a function that - accepts a composite parameter. Also, - it is possible to compare two row values or test a row with - IS NULL or IS NOT NULL, for example: - -SELECT ROW(1,2.5,'this is a test') = ROW(1, 3, 'not the same'); - -SELECT ROW(table.*) IS NULL FROM table; -- detect all-null rows - - For more detail see . - Row constructors can also be used in connection with subqueries, - as discussed in . + accepts a composite parameter. Also, it is possible to test rows + using the standard comparison operators as described in , to compare one row against another + as described in , and to + use them in connection with subqueries, as discussed in ,