Re: copy from ignores \,

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bauhofer Mario <m(dot)bauhofer(at)dieseitenmacher(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy from ignores \,
Date: 2005-08-19 13:45:19
Message-ID: 200508191345.j7JDjJh01014@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Read the COPY manual page --- backslashes are special and have to be
doubled to be treated as literal.

---------------------------------------------------------------------------

Bauhofer Mario wrote:
> Hi,
>
>
>
> i tried to copy a german text file into a table "imp" using copy from.
>
>
>
>
>
> SET client_encoding TO LATIN1; -- german umlaute
>
> Copy imp from 'filepath/filename.txt' delimiter as ',' Null as '\n';
>
>
>
> As you can see the "text" contains commas escaped by a backslash.
>
>
>
> But copy from ignores the \, an treat them as a separator
>
>
>
> Is this correct ?
>
>
>
> Do I miss something.
>
>
>
> Thx for the help!
>
>
>
> Create table imp(
>
> Id smallint,
>
> numberx int4,
>
> Text varchar(255)
>
> )
>
>
>
> ...
>
> 458,9009009,sometext1\,sometext2\,sometext3
>
> ..
>
>
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-08-19 13:46:39 Re: threads and transaction ...sample code and stored procedure
Previous Message Stephen Frost 2005-08-19 13:15:52 Re: BUG #1830: Non-super-user must be able to copy from a