Skip to content

Commit fb8e3f1

Browse files
committed
Add code to preserve paren level display after \g, as submitted months ago.
1 parent c03e7fb commit fb8e3f1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bin/psql/mainloop.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.45 2001/12/28 05:01:05 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.46 2002/02/18 05:57:41 momjian Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "mainloop.h"
@@ -447,7 +447,6 @@ MainLoop(FILE *source)
447447
{
448448
const char *end_of_cmd = NULL;
449449

450-
paren_level = 0;
451450
line[i - prevlen] = '\0'; /* overwrites backslash */
452451

453452
/* is there anything else on the line for the command? */
@@ -473,7 +472,7 @@ MainLoop(FILE *source)
473472
if ((slashCmdStatus == CMD_SEND || slashCmdStatus == CMD_NEWEDIT) &&
474473
query_buf->len == 0)
475474
{
476-
/* copy previous buffer to current for for handling */
475+
/* copy previous buffer to current for handling */
477476
appendPQExpBufferStr(query_buf, previous_buf->data);
478477
}
479478

@@ -487,6 +486,9 @@ MainLoop(FILE *source)
487486
resetPQExpBuffer(query_buf);
488487
}
489488

489+
if (query_buf->len == 0 && previous_buf->len == 0)
490+
paren_level = 0;
491+
490492
/* process anything left after the backslash command */
491493
i += end_of_cmd - &line[i];
492494
query_start = i;

0 commit comments

Comments
 (0)