aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-04-25 03:19:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-04-25 03:19:27 +0000
commit95cc41b81dd3917a1b9bb0b7c9cbe231d2557760 (patch)
tree528782b9d55a9ceb7acbe4cc55c0699514ab284d /src/backend/commands/explain.c
parentfc08814e00c04cddad512494bb52d9266928619e (diff)
downloadpostgresql-95cc41b81dd3917a1b9bb0b7c9cbe231d2557760.tar.gz
postgresql-95cc41b81dd3917a1b9bb0b7c9cbe231d2557760.zip
Revise backend libpq interfaces so that messages to the frontend
can be generated in a buffer and then sent to the frontend in a single libpq call. This solves problems with NOTICE and ERROR messages generated in the middle of a data message or COPY OUT operation.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 6745b4f1f38..a26579270c9 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 1994-5, Regents of the University of California
*
- * $Id: explain.c,v 1.34 1999/04/23 21:23:48 momjian Exp $
+ * $Id: explain.c,v 1.35 1999/04/25 03:19:09 tgl Exp $
*
*/
#include <stdio.h>
@@ -350,18 +350,13 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
static char *
Explain_PlanToString(Plan *plan, ExplainState *es)
{
- StringInfo str;
- char *s;
+ StringInfoData str;
- if (plan == NULL)
- return "";
- Assert(plan != NULL);
- str = makeStringInfo();
- explain_outNode(str, plan, 0, es);
- s = str->data;
- pfree(str);
-
- return s;
+ /* see stringinfo.h for an explanation of this maneuver */
+ initStringInfo(&str);
+ if (plan != NULL)
+ explain_outNode(&str, plan, 0, es);
+ return str.data;
}
/*