diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index d829a4b..96e3b2a 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -3947,9 +3947,13 @@ int PQsendQuery(PGconn *conn, const char *command);
 
        After successfully calling <function>PQsendQuery</function>, call
        <function>PQgetResult</function> one or more times to obtain the
-       results.  <function>PQsendQuery</function> cannot be called again
-       (on the same connection) until <function>PQgetResult</function>
-       has returned a null pointer, indicating that the command is done.
+       results.  <function>PQsendQuery</function> may be called multiple
+       times (on the same connection), allowing query pipelining. Call
+       <function>PQgetLastQuery</function> to get a <structname>PGquery</structname>
+       which can be used to identify which results obtained from
+       <function>PQgetResult</function> belong to each pipelined query dispatch.
+       If only one query is dispatched at a time, you can call <function>PQgetResult</function>
+       until a NULL value is returned to indicate the end of the query.
       </para>
      </listitem>
     </varlistentry>
@@ -4133,8 +4137,8 @@ PGresult *PQgetResult(PGconn *conn);
 
       <para>
        <function>PQgetResult</function> must be called repeatedly until
-       it returns a null pointer, indicating that the command is done.
-       (If called when no command is active,
+       it returns a null pointer, indicating that all dispatched commands
+       are done. (If called when no command is active,
        <function>PQgetResult</function> will just return a null pointer
        at once.) Each non-null result from
        <function>PQgetResult</function> should be processed using the
@@ -4144,14 +4148,19 @@ PGresult *PQgetResult(PGconn *conn);
        <function>PQgetResult</function> will block only if a command is
        active and the necessary response data has not yet been read by
        <function>PQconsumeInput</function>.
+       If query pipelining is being used, call 
+       <function>PQgetFirstQuery</function> on a non-busy connection
+       (<function>PQisBusy</function> returns false) to determine which
+       query the next result belongs to.
       </para>
 
       <note>
        <para>
         Even when <function>PQresultStatus</function> indicates a fatal
-        error, <function>PQgetResult</function> should be called until it
-        returns a null pointer, to allow <application>libpq</> to
-        process the error information completely.
+        error, <function>PQgetResult</function> should be called until the
+        query has no more results (null pointer return if not using query
+        pipelining, otherwise see <function>PQgetFirstQuery</function>),
+        to allow <application>libpq</> to process the error information completely.
        </para>
       </note>
      </listitem>
@@ -4385,6 +4394,109 @@ int PQflush(PGconn *conn);
    read-ready and then read the response as described above.
   </para>
 
+ <variablelist>
+  <varlistentry id="libpq-pqgetquerycommand">
+   <term>
+    <function>PQgetQueryCommand</function>
+    <indexterm>
+     <primary>PQgetQueryCommand</primary>
+    </indexterm>
+   </term>
+
+   <listitem>
+    <para>
+     Returns the query string associated with the <structure>PGquery</structure>.
+<synopsis>
+const char * PQgetQueryCommand(PGquery *query);
+</synopsis>
+    </para>
+
+    <para>
+     When using query pipelining this function can be used to retrieve the command
+     that created the query object.
+    </para>
+   </listitem>
+  </varlistentry>
+
+  <varlistentry id="libpq-pqgetfirstquery">
+   <term>
+    <function>PQgetFirstQuery</function>
+    <indexterm>
+     <primary>PQgetFirstQuery</primary>
+    </indexterm>
+   </term>
+
+   <listitem>
+    <para>
+     Returns the first async query to recieve results, or NULL if no
+     async queries are active.
+<synopsis>
+PGquery * PQgetFirstQuery(PGconn *conn);
+</synopsis>
+    </para>
+
+    <para>
+     When using query pipelining this function can be used to indicate
+     which query the next result of <function>PQgetResult</function>
+     belongs. The result is only guaranteed to be valid for the next call to
+     <function>PQgetResult</function> if <function>PQisBusy</function>
+     is false, otherwise the returned <structure>PGquery</structure>
+     may or may not have more results.  The <structure>PGquery</structure>
+     remains valid after <function>PQgetResult</function> until the next
+     libpq call that consumes input.
+    </para>
+   </listitem>
+  </varlistentry>
+
+  <varlistentry id="libpq-pqgetnextquery">
+   <term>
+    <function>PQgetNextQuery</function>
+    <indexterm>
+     <primary>PQgetNextQuery</primary>
+    </indexterm>
+   </term>
+
+   <listitem>
+    <para>
+     Returns the next <structure>PGquery</structure> in the list of
+     dispatched async queries waiting for results.
+<synopsis>
+PGquery * PQgetNextQuery(PGquery *query);
+</synopsis>
+    </para>
+
+    <para>
+     This function can be used to iterate each pending async query starting
+     with the result of <function>PQgetFirstQuery</function>, and ending
+     with the result of <function>PQgetLastQuery</function>, then null.
+    </para>
+   </varlistentry>
+
+   <varlistentry>
+    <term>
+     <function>PQgetLastQuery</function>
+     <indexterm>
+      <primary>PQgetLastQuery</primary>
+     </indexterm>
+    </term>
+
+    <listitem>
+     <para>
+      Returns the last <structure>PGquery</structure> in the list of
+      dispatched async queries waiting for results.
+<synopsis>
+PGquery * PQgetLastQuery(PGquery *query);
+</synopsis>
+     </para>
+
+     <para>
+      Call this function after dispatching an async query to get
+      a <structure>PGquery</structure> that can be used to identify
+      the originating query for each result obtained by
+      <function>PGgetResult</function>.
+     </para>
+   </varlistentry>
+  </variablelist>
  </sect1>
 
  <sect1 id="libpq-single-row-mode">
@@ -4411,7 +4523,7 @@ int PQflush(PGconn *conn);
    immediately after a successful call of <function>PQsendQuery</function>
    (or a sibling function).  This mode selection is effective only for the
    currently executing query.  Then call <function>PQgetResult</function>
-   repeatedly, until it returns null, as documented in <xref
+   repeatedly, until the last query result is returned, as documented in <xref
    linkend="libpq-async">.  If the query returns any rows, they are returned
    as individual <structname>PGresult</structname> objects, which look like
    normal query results except for having status code
@@ -4420,8 +4532,8 @@ int PQflush(PGconn *conn);
    the query returns zero rows, a zero-row object with status
    <literal>PGRES_TUPLES_OK</literal> is returned; this is the signal that no
    more rows will arrive.  (But note that it is still necessary to continue
-   calling <function>PQgetResult</function> until it returns null.)  All of
-   these <structname>PGresult</structname> objects will contain the same row
+   calling <function>PQgetResult</function> until the last query result is returned.)
+   All of these <structname>PGresult</structname> objects will contain the same row
    description data (column names, types, etc) that an ordinary
    <structname>PGresult</structname> object for the query would have.
    Each object should be freed with <function>PQclear</function> as usual.