Re: request for help with COPY syntax

From: "Chuck D(dot)" <pgsql-list(at)nullmx(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: request for help with COPY syntax
Date: 2007-10-26 02:16:15
Message-ID: 200710252016.16121.pgsql-list@nullmx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On October 25, 2007 03:16:59 pm Fernando Hevia wrote:
>
> As I understand it when a line starts with $ you would like to merge it
> with the previous line.
>

No, it appears the data file I am attempting to COPY has some records with
fields that contain a CR/LF in the data of that field. Postgres COPY fails
like this:

ERROR: literal carriage return found in data
HINT: Use "\r" to represent carriage return.
CONTEXT: COPY orig_city_world, line 1071850

I tried this, which I found on the web from Tom Lane:

sed 's/^M/\\r/g' geonames.txt > geonames_fixed.txt

But still get the same error. I used ctrl-v ctrl-m to reproduce the ^M. Not
sure why it is kicking out those lines still.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2007-10-26 03:22:10 Re: request for help with COPY syntax
Previous Message Fernando Hevia 2007-10-25 21:16:59 Re: request for help with COPY syntax