From b399805e221b5407f4f459c41661c86bb580680f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 11 Sep 1999 19:06:42 +0000 Subject: 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. --- src/backend/commands/explain.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/backend/commands/explain.c') 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; - } -} -- cgit v1.2.3