Skip site navigation (1) Skip section navigation (2)

COPY with multiple character delimiter?

From: "Celia McInnis" <celia(at)drmath(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: COPY with multiple character delimiter?
Date: 2005-05-25 16:14:13
Message-ID: 20050525154857.M17589@drmath.ca (view raw or flat)
Thread:
Lists: pgsql-novice
I will frequently have very large files of data which I'd like to be able to 
load quickly into a database, but the delimiter used in the files is not a 
single character (since the data could contain any character, a multiple 
character delimiter was used). Hence I unfortunately can't use the postgresql 
COPY command.

What's my best way of proceeding? Here are two possiblities I can think of:

1. Escape all of the tabs in my data, change the multiple-character delimiter 
to a tab and then use copy.

2. Write a little perl script which does line by line processing and 
inserting.

Is there any plan to have the COPY command allow multiple character 
delimiters?

Also, I just read a user comment on the postgresql site 
http://www.postgresql.org/docs/7.4/interactive/sql-copy.html that I may have 
to escape some high-ascii values anyway. Is this true?

If so, can somebody send me the guy's filter program? I'm at work and his 
site is not reachable from here. (I've never seen pornographic c code 
before :-), but that's the message my work is giving me when denying me 
access to his code at http://www.neverlight.com/~mental/pginput-filter.c )

Thanks,
Celia McInnis

pgsql-novice by date

Next:From: Kevin CrenshawDate: 2005-05-25 16:16:15
Subject: Re: Unable to Delete a Row
Previous:From: Sean DavisDate: 2005-05-25 15:45:22
Subject: Re: Migration from MySQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group