Index: doc/src/sgml/func.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/func.sgml,v
retrieving revision 1.465
diff -c -c -r1.465 func.sgml
*** doc/src/sgml/func.sgml	31 Dec 2008 00:08:33 -0000	1.465
--- doc/src/sgml/func.sgml	7 Jan 2009 21:04:02 -0000
***************
*** 11343,11349 ****
        <row>
         <entry><literal><function>current_query</function></literal></entry>
         <entry><type>text</type></entry>
!        <entry>text of the currently executing query (might contain more than one statement)</entry>
        </row>  
  
        <row>
--- 11343,11350 ----
        <row>
         <entry><literal><function>current_query</function></literal></entry>
         <entry><type>text</type></entry>
!        <entry>text of the currently executing query (might match
!          client-supplied query or be internal query string)</entry>
        </row>  
  
        <row>
Index: src/backend/utils/adt/misc.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v
retrieving revision 1.68
diff -c -c -r1.68 misc.c
*** src/backend/utils/adt/misc.c	7 Jan 2009 19:51:21 -0000	1.68
--- src/backend/utils/adt/misc.c	7 Jan 2009 21:04:02 -0000
***************
*** 31,36 ****
--- 31,37 ----
  #include "storage/pmsignal.h"
  #include "storage/procarray.h"
  #include "utils/builtins.h"
+ #include "tcop/pquery.h"
  #include "tcop/tcopprot.h"
  
  #define atooid(x)  ((Oid) strtoul((x), NULL, 10))
***************
*** 59,69 ****
  Datum
  current_query(PG_FUNCTION_ARGS)
  {
! 	/* there is no easy way to access the more concise 'query_string' */
! 	if (debug_query_string)
! 		PG_RETURN_TEXT_P(cstring_to_text(debug_query_string));
! 	else
! 		PG_RETURN_NULL();
  }
  
  /*
--- 60,66 ----
  Datum
  current_query(PG_FUNCTION_ARGS)
  {
! 	PG_RETURN_TEXT_P(cstring_to_text(ActivePortal->sourceText));
  }
  
  /*
