Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cb917e1

Browse files
committed
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.
1 parent c17e863 commit cb917e1

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

src/bin/psql/common.c

+5-19
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ AcceptResult(const PGresult *result)
450450
case PGRES_EMPTY_QUERY:
451451
case PGRES_COPY_IN:
452452
case PGRES_COPY_OUT:
453-
case PGRES_COPY_BOTH:
454453
/* Fine, do nothing */
455454
OK = true;
456455
break;
@@ -673,29 +672,17 @@ ProcessResult(PGresult **results)
673672
result_status = PQresultStatus(*results);
674673
switch (result_status)
675674
{
676-
case PGRES_COPY_BOTH:
677-
/*
678-
* No now-existing SQL command can yield PGRES_COPY_BOTH, but
679-
* defend against the future. PQexec() can't short-circuit
680-
* it's way out of a PGRES_COPY_BOTH, so the connection will
681-
* be useless at this point. XXX is there a method for
682-
* clearing this status that's likely to work with every
683-
* future command that can initiate it?
684-
*/
685-
psql_error("unexpected PQresultStatus (%d)", result_status);
686-
return false;
687-
688-
case PGRES_COPY_OUT:
689-
case PGRES_COPY_IN:
690-
is_copy = true;
691-
break;
692-
693675
case PGRES_EMPTY_QUERY:
694676
case PGRES_COMMAND_OK:
695677
case PGRES_TUPLES_OK:
696678
is_copy = false;
697679
break;
698680

681+
case PGRES_COPY_OUT:
682+
case PGRES_COPY_IN:
683+
is_copy = true;
684+
break;
685+
699686
default:
700687
/* AcceptResult() should have caught anything else. */
701688
is_copy = false;
@@ -817,7 +804,6 @@ PrintQueryResults(PGresult *results)
817804

818805
case PGRES_COPY_OUT:
819806
case PGRES_COPY_IN:
820-
case PGRES_COPY_BOTH:
821807
/* nothing to do here */
822808
success = true;
823809
break;

0 commit comments

Comments
 (0)