Re: Export tab delimited from mysql to postgres.

From: Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Export tab delimited from mysql to postgres.
Date: 2004-10-11 23:23:41
Message-ID: 82E30406384FFB44AFD1012BAB230B5505F40D3E@shiva.au.lpint.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Could you provide a example of how to do this?

I actually ended up exporting the data as Insert statements, which
strips out cf/lf within varchars. However it takes an eternity to import
200,000 records... 24 hours infact???? Is this normal?

Theo

-----Original Message-----
From: Harald Fuchs [mailto:hf0722x(at)protecting(dot)net]
Sent: Monday, 11 October 2004 7:34 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Export tab delimited from mysql to postgres.

In article <82E30406384FFB44AFD1012BAB230B5505F40D3A(at)shiva(dot)au(dot)lpint(dot)net>,
Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au> writes:

> Has anyone been able to export and import a tab delimited file from
> mysql to postgres successfully? This is my dilemma which I have posted
> on mysql sites with no response, however postgres users may have come
> across the same issue:

> Trying to export a tab delimited file with the following command,
> however it does not appear to strip out the CR/LF within a varchar
> column. select * into outfile '/tmp/users.txt' FIELDS ESCAPED BY '\\'
> LINES TERMINATED BY '\r\n' from users;

It's a MySQL bug/misfeature that it doesn't translate CRs into '\r'.
Nevertheless, you can import a MySQL tab delimited file into PostgreSQL -
just pipe it through a small sed script.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-10-11 23:40:50 Re: Export tab delimited from mysql to postgres.
Previous Message Janning Vygen 2004-10-11 11:03:37 Re: How do FKs work?