From: | "Ben Gould" <ben(dot)gould(at)free(dot)fr> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #2114: (patch) COPY FROM ... end of copy marker corrupt |
Date: | 2005-12-14 16:45:22 |
Message-ID: | 20051214164522.32DF0F0B12@svr2.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
The following bug has been logged online:
Bug reference: 2114
Logged by: Ben Gould
Email address: ben(dot)gould(at)free(dot)fr
PostgreSQL version: 8.1.0
Operating system: Mac OS X 10.4.3
Description: (patch) COPY FROM ... end of copy marker corrupt
Details:
With a table like:
CREATE TABLE test_table (
foo text,
bar text,
baz text
);
Using this format for COPY FROM:
COPY test_table FROM STDIN WITH CSV HEADER DELIMITER AS ',' NULL AS 'NULL'
QUOTE AS '\"' ESCAPE AS '\"'
Where the file was generated via:
COPY test_table TO STDOUT WITH CSV HEADER DELIMITER AS ',' NULL AS 'NULL'
QUOTE AS '\"' ESCAPE AS '\"' FORCE QUOTE foo, bar, baz;
I needed this patch:
<<<
--- postgresql-8.1.0.original/src/backend/commands/copy.c 2005-12-13
13:18:16.000000000 +0100
+++ postgresql-8.1.0/src/backend/commands/copy.c 2005-12-13
13:28:28.000000000 +0100
@@ -2531,7 +2531,7 @@
/*
* In CSV mode, we only recognize \. at start of line
*/
- if (c == '\\' && cstate->line_buf.len == 0)
+ if (c == '\\' && !in_quote && cstate->line_buf.len == 0)
{
char c2;
>>>
Because of this error message:
pg_endcopy warning: ERROR: end-of-copy marker corrupt
(We have quoted strings containing things like ..\..\.. in the CSV file
which broke the copy from.)
I was using DBD::Pg as the client library.
From | Date | Subject | |
---|---|---|---|
Next Message | David S. Edwards | 2005-12-14 18:16:19 | BUG #2115: If we CLOSE a Closed Cursor subsequent OPENs fail. |
Previous Message | Tom Lane | 2005-12-14 16:32:08 | Re: BUG #2112: query kills db thread |
From | Date | Subject | |
---|---|---|---|
Next Message | joe | 2005-12-14 16:48:38 | Re: TODO item: list prepared queries |
Previous Message | Tom Lane | 2005-12-14 15:58:00 | Re: TODO item: list prepared queries |