File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 3
3
*
4
4
* Copyright 2000 by PostgreSQL Global Development Group
5
5
*
6
- * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.47 2002/10/15 02:24:16 tgl Exp $
6
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.48 2002/10/15 16:44:21 tgl Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
@@ -236,19 +236,26 @@ PSQLexec(const char *query, bool ignore_command_ok)
236
236
if (var && strcmp (var , "noexec" ) == 0 )
237
237
return NULL ;
238
238
239
+ /* discard any uneaten results of past queries */
240
+ while ((newres = PQgetResult (pset .db )) != NULL )
241
+ PQclear (newres );
242
+
239
243
cancelConn = pset .db ;
240
244
if (PQsendQuery (pset .db , query ))
241
245
{
242
246
while ((newres = PQgetResult (pset .db )) != NULL )
243
247
{
244
- if ( ignore_command_ok &&
245
- PQresultStatus ( newres ) == PGRES_COMMAND_OK )
248
+ rstatus = PQresultStatus ( newres );
249
+ if ( ignore_command_ok && rstatus == PGRES_COMMAND_OK )
246
250
{
247
251
PQclear (newres );
248
252
continue ;
249
253
}
250
254
PQclear (res );
251
255
res = newres ;
256
+ if (rstatus == PGRES_COPY_IN ||
257
+ rstatus == PGRES_COPY_OUT )
258
+ break ;
252
259
}
253
260
}
254
261
rstatus = PQresultStatus (res );
You can’t perform that action at this time.
0 commit comments