MCPcopy Create free account
hub / github.com/apecloud/myduckserver / handleCopyFail

Method handleCopyFail

pgserver/connection_handler.go:924–940  ·  view source on GitHub ↗

handleCopyFail handles a COPY FAIL message by aborting the in-progress COPY DATA operation. The |stop| response parameter is true if the connection handler should shut down the connection, |endOfMessages| is true if no more COPY DATA messages are expected, and the server should tell the client that

(_ *pgproto3.CopyFail)

Source from the content-addressed store, hash-verified

922 loadDataResults, err := dataLoader.Finish(sqlCtx)
923 if err != nil {
924 return false, false, err
925 }
926
927 h.copyFromStdinState = nil
928 // We send back endOfMessage=true, since the COPY DONE message ends the COPY DATA flow and the server is ready
929 // to accept the next query now.
930 return false, true, h.send(&pgproto3.CommandComplete{
931 CommandTag: []byte(fmt.Sprintf("COPY %d", loadDataResults.RowsLoaded)),
932 })
933}
934
935// handleCopyFail handles a COPY FAIL message by aborting the in-progress COPY DATA operation. The |stop| response
936// parameter is true if the connection handler should shut down the connection, |endOfMessages| is true if no more
937// COPY DATA messages are expected, and the server should tell the client that it is ready for the next query, and
938// |err| contains any error that occurred while processing the COPY DATA message.
939func (h *ConnectionHandler) handleCopyFail(_ *pgproto3.CopyFail) (stop bool, endOfMessages bool, err error) {
940 if h.copyFromStdinState == nil {
941 return false, true,
942 fmt.Errorf("COPY FAIL message received without a COPY FROM STDIN operation in progress")
943 }

Callers 1

handleMessageMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected