Hi

current implementation of errhidecontext is not complete:

1. it sends context to client

2. it collect context although it will not be displayed

Attached patch fixing it
commit 7ee40ad6e5233f0ca2a5c10d1afcfb5d035164e6
Author: root <root@localhost.localdomain>
Date:   Thu Apr 30 11:59:45 2015 +0200

    fix bug in errhidecontext() implementation

diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index dfd102a..2a9d0fd 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -426,10 +426,11 @@ errfinish(int dummy,...)
 	 * functions will be treated as recursive errors --- this ensures we will
 	 * avoid infinite recursion (see errstart).
 	 */
-	for (econtext = error_context_stack;
-		 econtext != NULL;
-		 econtext = econtext->previous)
-		(*econtext->callback) (econtext->arg);
+	if (!edata->hide_ctx)
+		for (econtext = error_context_stack;
+			 econtext != NULL;
+			 econtext = econtext->previous)
+			(*econtext->callback) (econtext->arg);
 
 	/*
 	 * If ERROR (not more nor less) we pass it off to the current handler.
@@ -3137,7 +3138,7 @@ send_message_to_frontend(ErrorData *edata)
 			err_sendstring(&msgbuf, edata->hint);
 		}
 
-		if (edata->context)
+		if (edata->context && !edata->hide_ctx)
 		{
 			pq_sendbyte(&msgbuf, PG_DIAG_CONTEXT);
 			err_sendstring(&msgbuf, edata->context);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to