Commit cb917e15 authored by Tom Lane's avatar Tom Lane

Remove useless PGRES_COPY_BOTH "support" in psql.

There is no existing or foreseeable case in which psql should see a
PGRES_COPY_BOTH PQresultStatus; and if such a case ever emerges, it's a
pretty good bet that these code fragments wouldn't do the right thing
anyway.  Remove them, and let the existing default cases do the appropriate
thing, namely emit an "unexpected PQresultStatus" bleat.

Noted while working on libpq row processor patch, for which I was
considering adding a PGRES_SUSPENDED status code --- the same default-case
treatment would be appropriate for that.
parent c17e863b
......@@ -450,7 +450,6 @@ AcceptResult(const PGresult *result)
case PGRES_EMPTY_QUERY:
case PGRES_COPY_IN:
case PGRES_COPY_OUT:
case PGRES_COPY_BOTH:
/* Fine, do nothing */
OK = true;
break;
......@@ -673,29 +672,17 @@ ProcessResult(PGresult **results)
result_status = PQresultStatus(*results);
switch (result_status)
{
case PGRES_COPY_BOTH:
/*
* No now-existing SQL command can yield PGRES_COPY_BOTH, but
* defend against the future. PQexec() can't short-circuit
* it's way out of a PGRES_COPY_BOTH, so the connection will
* be useless at this point. XXX is there a method for
* clearing this status that's likely to work with every
* future command that can initiate it?
*/
psql_error("unexpected PQresultStatus (%d)", result_status);
return false;
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
is_copy = true;
break;
case PGRES_EMPTY_QUERY:
case PGRES_COMMAND_OK:
case PGRES_TUPLES_OK:
is_copy = false;
break;
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
is_copy = true;
break;
default:
/* AcceptResult() should have caught anything else. */
is_copy = false;
......@@ -817,7 +804,6 @@ PrintQueryResults(PGresult *results)
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
case PGRES_COPY_BOTH:
/* nothing to do here */
success = true;
break;
......
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