Commit fb8e3f15 authored by Bruce Momjian's avatar Bruce Momjian

Add code to preserve paren level display after \g, as submitted months ago.

parent c03e7fba
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.45 2001/12/28 05:01:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.46 2002/02/18 05:57:41 momjian Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "mainloop.h" #include "mainloop.h"
...@@ -447,7 +447,6 @@ MainLoop(FILE *source) ...@@ -447,7 +447,6 @@ MainLoop(FILE *source)
{ {
const char *end_of_cmd = NULL; const char *end_of_cmd = NULL;
paren_level = 0;
line[i - prevlen] = '\0'; /* overwrites backslash */ line[i - prevlen] = '\0'; /* overwrites backslash */
/* is there anything else on the line for the command? */ /* is there anything else on the line for the command? */
...@@ -473,7 +472,7 @@ MainLoop(FILE *source) ...@@ -473,7 +472,7 @@ MainLoop(FILE *source)
if ((slashCmdStatus == CMD_SEND || slashCmdStatus == CMD_NEWEDIT) && if ((slashCmdStatus == CMD_SEND || slashCmdStatus == CMD_NEWEDIT) &&
query_buf->len == 0) query_buf->len == 0)
{ {
/* copy previous buffer to current for for handling */ /* copy previous buffer to current for handling */
appendPQExpBufferStr(query_buf, previous_buf->data); appendPQExpBufferStr(query_buf, previous_buf->data);
} }
...@@ -487,6 +486,9 @@ MainLoop(FILE *source) ...@@ -487,6 +486,9 @@ MainLoop(FILE *source)
resetPQExpBuffer(query_buf); resetPQExpBuffer(query_buf);
} }
if (query_buf->len == 0 && previous_buf->len == 0)
paren_level = 0;
/* process anything left after the backslash command */ /* process anything left after the backslash command */
i += end_of_cmd - &line[i]; i += end_of_cmd - &line[i];
query_start = i; query_start = i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment