Bug in COPY from CSV? - Mailing list pgsql-general

From Rick Schumeyer
Subject Bug in COPY from CSV?
Date
Msg-id 005b01c5059e$3670a210$0200a8c0@dell8200
Whole thread Raw
Responses Re: Bug in COPY from CSV?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general

I think I’ve found a bug in PG 8.0 that occurs while copying from CSV files.

I checked the bugs list but didn’t see anything similar.

 

This occurs when reading a CSV file where one of the ‘text’ fields has

a blank line.  I included an example that shows the problem below.

I found that if I change the blank line to have one space, pg reads

it just fine.

 

If this is indeed a bug, if someone could let me know the best

way to address it, I would appreciate it.

 

--EXAMPLE

 create table t (

      id integer,

      description text

);

 

copy t from stdin with null as '' csv quote as '"';

1,"Now is the time"

2,"for all good men

to come

to the

 

aid of their party"

3,"The quick brown fox"

\.

--END EXAMPLE

 

The above example produces this output:

 

CREATE TABLE

psql:test2.sql:8: ERROR:  unterminated CSV quoted field

CONTEXT:  COPY t, line 5: ""

 

pgsql-general by date:

Previous
From: Mike Benoit
Date:
Subject: Postgresql v8.0 debian packages.
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Mail list / web issues