From 3d2849820b03f18199f0253fa21a1d31e5670c4f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 26 Oct 2004 22:16:12 +0000 Subject: [PATCH] Document IS DISTINCT FROM in a more obvious place, and add some more index entries for IS-foo constructs. --- doc/src/sgml/func.sgml | 81 +++++++++++++++++++++++++++++++++++++--- doc/src/sgml/syntax.sgml | 14 +++++-- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 7e1b488bae..fb55b1bff7 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -283,6 +283,18 @@ PostgreSQL documentation + + IS NULL + + + IS NOT NULL + + + ISNULL + + + NOTNULL + To check whether a value is or is not null, use the constructs expression IS NULL @@ -305,6 +317,7 @@ PostgreSQL documentation behavior conforms to the SQL standard. + Some applications may expect that expression = NULL @@ -318,8 +331,43 @@ PostgreSQL documentation the default behavior in PostgreSQL releases 6.5 through 7.1. + + + IS DISTINCT FROM + + The ordinary comparison operators yield null (signifying unknown) + when either input is null. Another way to do comparisons is with the + IS DISTINCT FROM construct: + +expression IS DISTINCT FROM expression + + For non-null inputs this is the same as the <> operator. + However, when both inputs are null it will return false, and when just + one input is null it will return true. Thus it effectively acts as though + null were a normal data value, rather than unknown. + + + + + IS TRUE + + + IS NOT TRUE + + + IS FALSE + + + IS NOT FALSE + + + IS UNKNOWN + + + IS NOT UNKNOWN + Boolean values can also be tested using the constructs expression IS TRUE @@ -329,9 +377,13 @@ PostgreSQL documentation expression IS UNKNOWN expression IS NOT UNKNOWN - These are similar to IS NULL in that they will - always return true or false, never a null value, even when the operand is null. + These will always return true or false, never a null value, even when the + operand is null. A null input is treated as the logical value unknown. + Notice that IS UNKNOWN and IS NOT UNKNOWN are + effectively the same as IS NULL and + IS NOT NULL, respectively, except that the input + expression must be of Boolean type. @@ -7344,7 +7396,7 @@ SELECT col1 FROM tab1 - <literal>NOT IN </literal> + <literal>NOT IN</literal> expression NOT IN (subquery) @@ -7538,9 +7590,9 @@ SELECT col1 FROM tab1 Row-wise Comparison - + comparison - of rows + subquery result row @@ -7594,6 +7646,23 @@ SELECT col1 FROM tab1 SOME + + comparison + row-wise + + + + IS DISTINCT FROM + + + + IS NULL + + + + IS NOT NULL + + This section describes several specialized constructs for making multiple comparisons between groups of values. These forms are diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 98deceb895..99038b4269 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,5 +1,5 @@ @@ -1421,6 +1421,10 @@ SELECT name, (SELECT max(pop) FROM cities WHERE cities.state = states.name) constructor + + ARRAY + + An array constructor is an expression that builds an 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%'); constructor + + ROW + + A row constructor is an expression that builds a row value (also called a composite value) from values for its member fields. A row constructor consists of the key word - ROW, a left parenthesis (, zero or more + ROW, a left parenthesis, zero or more expressions (separated by commas) for the row field values, and finally - a right parenthesis ). For example, + a right parenthesis. For example, SELECT ROW(1,2.5,'this is a test');