dbTalk Databases Forums  

[BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker corrupt

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker corrupt in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ben Gould
 
Posts: n/a

Default [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker corrupt - 12-14-2005 , 06:41 PM







The following bug has been logged online:

Bug reference: 2114
Logged by: Ben Gould
Email address: ben.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;
Quote:
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.

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.