Re: Escaping in COPY

From: Gunther Schadow <gunther(at)aurora(dot)regenstrief(dot)org>
To: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Escaping in COPY
Date: 2002-06-05 21:54:58
Message-ID: 3CFE88B2.4030606@aurora.regenstrief.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Jeroen T. Vermeulen wrote:

> How exactly does one escape tabs, newlines etc. when using COPY?
>
> I remember reading somewhere that one just prefixes a backslash to them
> before passing them to PQputline(). And indeed, that seems to work fine.
>
> But when the data is retrieved using another COPY and PQgetline(), I
> find the tabs are escaped as '\t'. I looked around the website and the
> mailing list archives, but found nothing on this subject.
>
> Can anyone tell me the definitive place to look?

I'd be interested too. From the manual I gather that it is extremely
simple. Only the field delimiter and the row delimiter (alias newline)
and the escape character itself needs escaping. I have just finished
uploading a 15 GB medical record database from Oracle and it actually
worked. I am also very pleased with PostgreSQL's performance so far.
Ah, this is getting good! I can pump data in at basically the same
rate that I read it from Oracle. That is, 600 to 2000 records per
second, and it is with all indexes and foreign keys turned on (FKs
are initially deferred, but eventually they are checked.)

This is coool,
-Gunther

--
Gunther Schadow, M.D., Ph.D. gschadow(at)regenstrief(dot)org
Medical Information Scientist Regenstrief Institute for Health Care
Adjunct Assistant Professor Indiana University School of Medicine
tel:1(317)630-7960 http://aurora.regenstrief.org

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2002-06-05 23:01:40 Re: Escaping in COPY
Previous Message Jeroen T. Vermeulen 2002-06-05 18:16:26 Escaping in COPY