Skip to content

Commit

Permalink
fix: Update error message for COPY commands executed using JDBC API
Browse files Browse the repository at this point in the history
  • Loading branch information
sehrope committed Jan 29, 2019
1 parent 2341623 commit e7d2be7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
public class QueryExecutorImpl extends QueryExecutorBase {

private static final Logger LOGGER = Logger.getLogger(QueryExecutorImpl.class.getName());
private static final String COPY_ERROR_MESSAGE = "COPY commands are only supported using the CopyManager API.";

/**
* TimeZone of the current connection (TimeZone backend parameter).
Expand Down Expand Up @@ -2297,8 +2298,7 @@ protected void processResults(ResultHandler handler, int flags) throws IOExcepti
// We'll send a CopyFail message for COPY FROM STDIN so that
// server does not wait for the data.

byte[] buf =
Utils.encodeUTF8("The JDBC driver currently does not support COPY operations.");
byte[] buf = Utils.encodeUTF8(COPY_ERROR_MESSAGE);
pgStream.sendChar('f');
pgStream.sendInteger4(buf.length + 4 + 1);
pgStream.send(buf);
Expand All @@ -2315,7 +2315,7 @@ protected void processResults(ResultHandler handler, int flags) throws IOExcepti
// In case of CopyOutResponse, we cannot abort data transfer,
// so just throw an error and ignore CopyData messages
handler.handleError(
new PSQLException(GT.tr("The driver currently does not support COPY operations."),
new PSQLException(GT.tr(COPY_ERROR_MESSAGE),
PSQLState.NOT_IMPLEMENTED));
break;

Expand Down

0 comments on commit e7d2be7

Please sign in to comment.