forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit218dd20
committed
Clean up error cases in psql's COPY TO STDOUT/FROM STDIN code.
Adjust handleCopyOut() to stop trying to write data once it's failedone time. For typical cases such as out-of-disk-space or broken-pipe,additional attempts aren't going to do anything but waste time, andin any case clean truncation of the output seems like a better behaviorthan randomly dropping blocks in the middle.Also remove dubious (and misleadingly documented) attempt to force our wayout of COPY_OUT state if libpq didn't do that. If we did have a situationlike that, it'd be a bug in libpq and would be better fixed there, IMO.We can hope that commitfa4440f took careof any such problems, anyway.Also fix longstanding bug in handleCopyIn(): PQputCopyEnd() only supportsa non-null errormsg parameter in protocol version 3, and will activelyfail if one is passed in version 2. This would've made our attemptsto get out of COPY_IN state after a failure into infinite loops whentalking to pre-7.4 servers.Back-patch the COPY_OUT state change business back to 9.2 where it wasintroduced, and the other two fixes into all supported branches.1 parent148052d commit218dd20
1 file changed
+13
-8
lines changedLines changed: 13 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
350 | 350 |
| |
351 | 351 |
| |
352 | 352 |
| |
353 |
| - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
354 | 356 |
| |
355 | 357 |
| |
356 | 358 |
| |
| |||
397 | 399 |
| |
398 | 400 |
| |
399 | 401 |
| |
400 |
| - | |
| 402 | + | |
401 | 403 |
| |
402 | 404 |
| |
403 | 405 |
| |
404 |
| - | |
| 406 | + | |
405 | 407 |
| |
406 |
| - | |
407 |
| - | |
408 |
| - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
409 | 411 |
| |
410 | 412 |
| |
411 | 413 |
| |
| |||
469 | 471 |
| |
470 | 472 |
| |
471 | 473 |
| |
472 |
| - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
473 | 477 |
| |
474 | 478 |
| |
475 | 479 |
| |
| |||
597 | 601 |
| |
598 | 602 |
| |
599 | 603 |
| |
600 |
| - | |
| 604 | + | |
| 605 | + | |
601 | 606 |
| |
602 | 607 |
| |
603 | 608 |
| |
|
0 commit comments
Comments
(0)