| From: | Bruce Momjian <bruce(at)momjian(dot)us> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | tgarnett(at)panjiva(dot)com, pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #7709: psql \copy csv terminates with \. in quoted region |
| Date: | 2013-07-04 17:10:01 |
| Message-ID: | 20130704171001.GD17790@momjian.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Tue, Nov 27, 2012 at 12:33:44PM -0500, Tom Lane wrote:
> tgarnett(at)panjiva(dot)com writes:
> > psql \copy terminates at \. by itself in a line even if the format is csv
> > and the \. is inside a quoted region. This means that some values can't be
> > round-tripped by psql \copy. Tested and the native postgresql COPY handles
> > this case correctly.
>
> Ugh. This seems like a rather fundamental oversight in the CSV feature.
> The problem is that psql has no idea whether the copy is being done in
> CSV mode or not --- and even if it did, it doesn't parse the data fully
> enough to realize whether a \. line is inside quotes or not.
>
> In the case of out-of-line data files, it might be reasonable to just
> dispense with the check for \. altogether and always ship the whole file
> to the backend; I think there's a \. check on the backend side. (Not
> sure this is safe in V2 protocol, but I doubt anyone cares anymore
> about that.)
>
> In the case of in-line data in a script file, CSV mode seems a bit
> broken in any case; there's no concept of a terminator in CSV, AFAIK.
> So maybe we don't have to worry about that.
I have added a C comment documenting this bug; patch attached.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
| Attachment | Content-Type | Size |
|---|---|---|
| copy.diff | text/x-diff | 647 bytes |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chad Wagner | 2013-07-04 18:41:08 | Re: Stalled post to pgsql-bugs |
| Previous Message | Noah Misch | 2013-07-04 16:12:07 | Re: windows 8 RTM compatibility issue (could not reserve shared memory region for child) |