From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Clean up error cases in psql's COPY TO STDOUT/FROM STDIN code. |
Date: | 2014-02-13 23:46:19 |
Message-ID: | E1WE5z1-0005Qf-0Y@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Clean up error cases in psql's COPY TO STDOUT/FROM STDIN code.
Adjust handleCopyOut() to stop trying to write data once it's failed
one time. For typical cases such as out-of-disk-space or broken-pipe,
additional attempts aren't going to do anything but waste time, and
in any case clean truncation of the output seems like a better behavior
than randomly dropping blocks in the middle.
Also remove dubious (and misleadingly documented) attempt to force our way
out of COPY_OUT state if libpq didn't do that. If we did have a situation
like that, it'd be a bug in libpq and would be better fixed there, IMO.
We can hope that commit fa4440f51628d692f077d54b8313aea31af087ea took care
of any such problems, anyway.
Also fix longstanding bug in handleCopyIn(): PQputCopyEnd() only supports
a non-null errormsg parameter in protocol version 3, and will actively
fail if one is passed in version 2. This would've made our attempts
to get out of COPY_IN state after a failure into infinite loops when
talking to pre-7.4 servers.
Back-patch the COPY_OUT state change business back to 9.2 where it was
introduced, and the other two fixes into all supported branches.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/b8f00a46bc4ae77c09f4564f3b3c675fb9e51974
Modified Files
--------------
src/bin/psql/copy.c | 75 +++++++++++++++++++++++++--------------------------
1 file changed, 37 insertions(+), 38 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-02-14 02:46:39 | pgsql: Add C comment about problems with CHAR() space trimming |
Previous Message | Alvaro Herrera | 2014-02-13 22:39:01 | pgsql: Separate multixact freezing parameters from xid's |