Skip to content

Commit

Permalink
Removed the assertion. Instead, disconnect the client session and bac…
Browse files Browse the repository at this point in the history
…kend if COPY FROM STDIN bypasses the initial checks and lands here
  • Loading branch information
rahim-kanji committed Nov 26, 2024
1 parent f33fd02 commit ba8dc5f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/PgSQL_Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1830,9 +1830,17 @@ PG_ASYNC_ST PgSQL_Connection::handler(short event) {
break;
case PGRES_COPY_IN:
case PGRES_COPY_BOTH:
// NOT IMPLEMENTED
proxy_error("COPY not supported\n");
assert(0);
// disconnect client session (and backend connection) if COPY (STDIN) command bypasses the initial checks.
// This scenario should be handled in fast-forward mode and should never occur at this point.
if (myds && myds->sess) {
proxy_warning("Unable to process the '%s' command from client %s:%d. Please report a bug for future enhancements.\n",
myds->sess->CurrentQuery.QueryParserArgs.digest_text ? myds->sess->CurrentQuery.QueryParserArgs.digest_text : "COPY",
myds->sess->client_myds->addr.addr, myds->sess->client_myds->addr.port);
} else {
proxy_warning("Unable to process the 'COPY' command. Please report a bug for future enhancements.\n");
}
set_error(PGSQL_ERROR_CODES::ERRCODE_RAISE_EXCEPTION, "Unable to process 'COPY' command", true);
NEXT_IMMEDIATE(ASYNC_QUERY_END);
break;
case PGRES_BAD_RESPONSE:
case PGRES_NONFATAL_ERROR:
Expand Down

0 comments on commit ba8dc5f

Please sign in to comment.