Revert current_query() change to use debug_query_string again; add comment.
authorBruce Momjian
Thu, 8 Jan 2009 00:13:22 +0000 (00:13 +0000)
committerBruce Momjian
Thu, 8 Jan 2009 00:13:22 +0000 (00:13 +0000)
doc/src/sgml/func.sgml
src/backend/utils/adt/misc.c

index 897762f6e6987c132df534153d4e7f9e6cdbd4bf..72d34efb8bf307877ce3c902b4eacdacb6f597c9 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   Functions and Operators
@@ -11343,8 +11343,7 @@ postgres=# select * from unnest2(array[[1,2],[3,4]]);
       
        current_query
        text
-       text of the currently executing query (might match
-         client-supplied query or be internal query string)
+       text of the currently executing query (might contain more than one statement)
         
 
       
index bc068932e9d88555046481f28b19584c7f558494..904abb911b16cb9dfed9ea52f80a6ec345b2718a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.69 2009/01/07 21:48:15 momjian Exp $
+ *   $PostgreSQL: pgsql/src/backend/utils/adt/misc.c,v 1.70 2009/01/08 00:13:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,6 @@
 #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))
@@ -56,11 +55,16 @@ current_database(PG_FUNCTION_ARGS)
 /*
  * current_query()
  *  Expose the current query to the user (useful in stored procedures)
+ *  We might want to use ActivePortal->sourceText someday. 
  */
 Datum
 current_query(PG_FUNCTION_ARGS)
 {
-   PG_RETURN_TEXT_P(cstring_to_text(ActivePortal->sourceText));
+   /* 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();
 }
 
 /*