Re: BUG #4486: CSV feature request

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Grillet <andrew(at)grillet(dot)co(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4486: CSV feature request
Date: 2008-10-23 20:03:08
Message-ID: 200810232003.m9NK38705772@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Grillet wrote:
>
> The following bug has been logged online:
>
> Bug reference: 4486
> Logged by: Andrew Grillet
> Email address: andrew(at)grillet(dot)co(dot)uk
> PostgreSQL version: 8.3
> Operating system: Windows XP
> Description: CSV feature request
> Details:
>
> Excel 2007 decides on the fly whether to quote fields or not on the basis of
> whther individual rows have a comma in that field. There does not appear any
> obvious way to prevent this bizarre behaviour.
>
> I suggest the syntax:
>
> COPY table (columns) FROM 'filename.csv. with csv OPTIONAL QUOTE [AS '"'];
>
> As a way to tell PostgreSQL this behaviour is expected and must be handled
> without complaint. Default should be to complain if file is stupidly
> formatted.

What problem are you having, exactly? I tried this:

test=> create table test (x text, y text);
test=> copy test from '/rtmp/1' with csv;
COPY 3

where /rtmp/1 had:

"a", "b"
a, "b"
a, b

and saw no errors or warnings. Are you saying we should complain, and
if so, why?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Zdenek Kotala 2008-10-24 10:51:52 Re: Upgrade from 7.4.5 to 8.3.3
Previous Message Bruce Momjian 2008-10-23 19:41:25 Re: ftp server symlink