*** pgsql/src/bin/psql/copy.c 2009/04/26 15:31:50 1.80 --- pgsql/src/bin/psql/copy.c 2009/08/07 20:16:16 1.80.2.1 *************** *** 3,9 **** * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.79 2009/01/01 17:23:54 momjian Exp $ */ #include "postgres_fe.h" #include "copy.h" --- 3,9 ---- * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * ! * $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.80 2009/04/26 15:31:50 tgl Exp $ */ #include "postgres_fe.h" #include "copy.h" *************** do_copy(const char *args) *** 571,576 **** --- 571,579 ---- success = false; psql_error("\\copy: unexpected response (%d)\n", PQresultStatus(result)); + /* if still in COPY IN state, try to get out of it */ + if (PQresultStatus(result) == PGRES_COPY_IN) + PQputCopyEnd(pset.db, _("trying to exit copy mode")); PQclear(result); }