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

Re: Export tab delimited from mysql to postgres.

From: Harald Fuchs <hf0722x(at)protecting(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Export tab delimited from mysql to postgres.
Date: 2004-10-11 09:33:55
Message-ID: pu4ql1mwe4.fsf@srv.protecting.net (view raw or flat)
Thread:
Lists: pgsql-sql
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.


In response to

pgsql-sql by date

Next:From: Gary StainburnDate: 2004-10-11 09:49:24
Subject: table update using result from join
Previous:From: Richard HuxtonDate: 2004-10-11 09:21:31
Subject: Re: SQL doubt - Date Add

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