Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4a7c25

Browse files
committed
Fix unintentional breakage of COPY TO/FROM stdin. Mea culpa.
1 parent3a2ef59 commitf4a7c25

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

‎src/bin/psql/common.c

Lines changed: 10 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/common.c,v 1.47 2002/10/1502:24:16 tgl Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.48 2002/10/1516:44:21 tgl Exp $
77
*/
88
#include"postgres_fe.h"
99

@@ -236,19 +236,26 @@ PSQLexec(const char *query, bool ignore_command_ok)
236236
if (var&&strcmp(var,"noexec")==0)
237237
returnNULL;
238238

239+
/* discard any uneaten results of past queries */
240+
while ((newres=PQgetResult(pset.db))!=NULL)
241+
PQclear(newres);
242+
239243
cancelConn=pset.db;
240244
if (PQsendQuery(pset.db,query))
241245
{
242246
while ((newres=PQgetResult(pset.db))!=NULL)
243247
{
244-
if (ignore_command_ok&&
245-
PQresultStatus(newres)==PGRES_COMMAND_OK)
248+
rstatus=PQresultStatus(newres);
249+
if (ignore_command_ok&&rstatus==PGRES_COMMAND_OK)
246250
{
247251
PQclear(newres);
248252
continue;
249253
}
250254
PQclear(res);
251255
res=newres;
256+
if (rstatus==PGRES_COPY_IN||
257+
rstatus==PGRES_COPY_OUT)
258+
break;
252259
}
253260
}
254261
rstatus=PQresultStatus(res);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp