Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.513
diff -c -c -r1.513 func.sgml
*** doc/src/sgml/func.sgml	7 Apr 2010 06:12:52 -0000	1.513
--- doc/src/sgml/func.sgml	1 Jun 2010 14:40:22 -0000
***************
*** 3445,3463 ****
     </para>
  
      <para>
!      The <function>regexp_matches</> function returns all of the captured
!      substrings resulting from matching a POSIX regular expression pattern.
!      It has the syntax
       <function>regexp_matches</function>(<replaceable>string</>, <replaceable>pattern</>
       <optional>, <replaceable>flags</> </optional>).
!      If there is no match to the <replaceable>pattern</>, the function returns
!      no rows.  If there is a match, the function returns a text array whose
       <replaceable>n</>'th element is the substring matching the
       <replaceable>n</>'th parenthesized subexpression of the pattern
       (not counting <quote>non-capturing</> parentheses; see below for
!      details).  If the pattern does not contain any parenthesized
!      subexpressions, then the result is a single-element text array containing
!      the substring matching the whole pattern.
       The <replaceable>flags</> parameter is an optional text
       string containing zero or more single-letter flags that change the
       function's behavior.  Flag <literal>g</> causes the function to find
--- 3445,3466 ----
     </para>
  
      <para>
!      The <function>regexp_matches</> function returns a text array of
!      all of the captured substrings resulting from matching a POSIX
!      regular expression pattern.  It has the syntax
       <function>regexp_matches</function>(<replaceable>string</>, <replaceable>pattern</>
       <optional>, <replaceable>flags</> </optional>).
!      The function can return no rows, one row, or multiple rows (see
!      the <literal>g</> flag below).  If the <replaceable>pattern</>
!      does not match, the function returns no rows.  If the pattern
!      contains no parenthesized subexpressions, then each row
!      returned is a single-element text array containing the substring
!      matching the whole pattern.  If the pattern contains parenthesized
!      subexpressions, the function returns a text array whose
       <replaceable>n</>'th element is the substring matching the
       <replaceable>n</>'th parenthesized subexpression of the pattern
       (not counting <quote>non-capturing</> parentheses; see below for
!      details).
       The <replaceable>flags</> parameter is an optional text
       string containing zero or more single-letter flags that change the
       function's behavior.  Flag <literal>g</> causes the function to find
***************
*** 3490,3495 ****
--- 3493,3508 ----
  </programlisting>
     </para>
  
+    <para>
+     It is possible to force <function>regexp_matches()</> to always
+     return one row by using a sub-select;  this is particularly useful
+     in a <literal>SELECT</> target list when you want all rows
+     returned, even non-matching ones:
+ <programlisting>
+ SELECT col1, (SELECT regexp_matches(col2, '(bar)(beque)')) FROM tab;
+ </programlisting>
+    </para>
+ 
      <para>
       The <function>regexp_split_to_table</> function splits a string using a POSIX
       regular expression pattern as a delimiter.  It has the syntax
