Re: issue with delimiter in field during COPY

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: LPlateAndy <andy(at)centremaps(dot)co(dot)uk>
Subject: Re: issue with delimiter in field during COPY
Date: 2011-11-14 14:23:19
Message-ID: 201111140623.19623.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Monday, November 14, 2011 5:39:41 am LPlateAndy wrote:
> Hi,
>
> Using COPY to bring data into a table. It uses "|" which i allow for with a
> command such as:
>
> COPY mydata FROM E'C:\\mydata\\mydata.txt' USING DELIMITERS '|'
>
> This works fine except for a url field which randomly includes a pipeline
> "|" character. Despite the url being in quotation (" ") marks, the field is
> split in two resulting in an unexpected number of columns.
>
> Looking at the data imported, i can see that the quotation marks seem to
> have been imported as well rather than the content recognised as text.
>
> Is there any way to force the system to recognise the quotation marks, the
> info in postgres 9.0 documentation seems to suggest that it is only
> possible to specify the quotation marks using 'quote' for CSV format
> (along with specifying the header).

Yes, you will need to use CSV format to specify a quote character. No you do not
have to specify a HEADER. The HEADER option is a toggle, if it is present it
indicates that there is a header row. If it is not present than that indicates
there is no header.

>
> Any help much appreciated...
>
> Andy
>
>
> --

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message LPlateAndy 2011-11-14 14:27:10 Re: issue with delimiter in field during COPY
Previous Message LPlateAndy 2011-11-14 14:20:33 Re: issue with delimiter in field during COPY