Commit ea7b4f1f authored by Tom Lane's avatar Tom Lane

Ensure previous setting of pset.queryFout is restored after a failed

backslash-g command.
parent 08372d4e
......@@ -3,7 +3,7 @@
*
* Copyright 2000 by PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.30 2001/02/10 02:31:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.31 2001/03/01 18:34:29 tgl Exp $
*/
#include "postgres_fe.h"
......@@ -429,34 +429,35 @@ SendQuery(const char *query)
FILE *queryFout_copy = pset.queryFout;
bool queryFoutPipe_copy = pset.queryFoutPipe;
pset.queryFout = NULL; /* so it doesn't get
pset.queryFout = stdout; /* so it doesn't get
* closed */
/* open file/pipe */
if (!setQFout(pset.gfname))
{
pset.queryFout = queryFout_copy;
pset.queryFoutPipe = queryFoutPipe_copy;
success = false;
break;
}
printQuery(results, &pset.popt, pset.queryFout);
/* close file/pipe */
/* close file/pipe, restore old setting */
setQFout(NULL);
free(pset.gfname);
pset.gfname = NULL;
pset.queryFout = queryFout_copy;
pset.queryFoutPipe = queryFoutPipe_copy;
free(pset.gfname);
pset.gfname = NULL;
success = true;
break;
}
else
{
success = true;
printQuery(results, &pset.popt, pset.queryFout);
success = true;
}
break;
case PGRES_EMPTY_QUERY:
......
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