diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-11 19:06:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-11 19:06:42 +0000 |
commit | b399805e221b5407f4f459c41661c86bb580680f (patch) | |
tree | fdab78c0187b25724fe31b456fd79f3a15a3ed6b /src/backend/commands/explain.c | |
parent | 1e4f0197bb3271b4ed2427b8c661a34aaaf7c220 (diff) | |
download | postgresql-b399805e221b5407f4f459c41661c86bb580680f.tar.gz postgresql-b399805e221b5407f4f459c41661c86bb580680f.zip |
Eliminate elog()'s hardwired limit on length of an error message.
This change seems necessary in conjunction with long queries, and it
cleans up some bogosity in connection with long EXPLAIN texts anyway.
Note that current libpq will accept any length error message (at least
until it runs out of memory); prior versions have a limit of 8K, but
will cleanly discard excess error text, so there shouldn't be any
big compatibility problems with old clients.
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 07caedde8be..3b1da18783d 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.46 1999/08/31 01:28:28 tgl Exp $ + * $Id: explain.c,v 1.47 1999/09/11 19:06:36 tgl Exp $ * */ @@ -28,7 +28,6 @@ typedef struct ExplainState } ExplainState; static char *Explain_PlanToString(Plan *plan, ExplainState *es); -static void printLongNotice(const char *header, const char *message); static void ExplainOneQuery(Query *query, bool verbose, CommandDest dest); /* Convert a null string pointer into "<>" */ @@ -110,7 +109,7 @@ ExplainOneQuery(Query *query, bool verbose, CommandDest dest) s = nodeToString(plan); if (s) { - printLongNotice("QUERY DUMP:\n\n", s); + elog(NOTICE, "QUERY DUMP:\n\n%s", s); pfree(s); } } @@ -120,7 +119,7 @@ ExplainOneQuery(Query *query, bool verbose, CommandDest dest) s = Explain_PlanToString(plan, es); if (s) { - printLongNotice("QUERY PLAN:\n\n", s); + elog(NOTICE, "QUERY PLAN:\n\n%s", s); pfree(s); } } @@ -332,7 +331,6 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es) } es->rtable = saved_rtable; } - return; } static char * @@ -346,22 +344,3 @@ Explain_PlanToString(Plan *plan, ExplainState *es) explain_outNode(&str, plan, 0, es); return str.data; } - -/* - * Print a message that might exceed the size of the elog message buffer. - * This is a crock ... there shouldn't be an upper limit to what you can elog(). - */ -static void -printLongNotice(const char *header, const char *message) -{ - int len = strlen(message); - - elog(NOTICE, "%.20s%.*s", header, ELOG_MAXLEN - 64, message); - len -= ELOG_MAXLEN - 64; - while (len > 0) - { - message += ELOG_MAXLEN - 64; - elog(NOTICE, "%.*s", ELOG_MAXLEN - 64, message); - len -= ELOG_MAXLEN - 64; - } -} |