Merge pull request #1078 from otan-cockroach/copydata · lib/pq@da91844

Original file line numberDiff line numberDiff line change

@@ -274,8 +274,13 @@ func (ci *copyin) Exec(v []driver.Value) (r driver.Result, err error) {

274274

return driver.RowsAffected(0), nil

275275

}

276276
277-

// CopyData executes a raw CopyData command using the PostgreSQL Frontend/Backend

278-

// protocol. Use Exec(nil) to finish the command.

277+

// CopyData inserts a raw string into the COPY stream. The insert is

278+

// asynchronous and CopyData can return errors from previous CopyData calls to

279+

// the same COPY stmt.

280+

//

281+

// You need to call Exec(nil) to sync the COPY stream and to get any

282+

// errors from pending data, since Stmt.Close() doesn't return errors

283+

// to the user.

279284

func (ci *copyin) CopyData(ctx context.Context, line string) (r driver.Result, err error) {

280285

if ci.closed {

281286

return nil, errCopyInClosed