Re: Transfer from MySQL to PostgreSQL

From: "Guido Barosio" <gbarosio(at)gmail(dot)com>
To: "Christoph Frick" <frick(at)sc-networks(dot)com>
Cc: Andrea <andrea(dot)b73(at)email(dot)it>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Transfer from MySQL to PostgreSQL
Date: 2006-03-28 12:22:39
Message-ID: f7f6b4c70603280422h75801566p14812970fdc4fa1c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Use SELECT ...INTO OUTFILE and treat the data as a csv while importing
with COPY from the pgsql side.

from mysql docs: The SELECT ... INTO OUTFILE 'file_name' form of
SELECT writes the selected rows to a file. The file is created on the
server host, so you must have the FILE privilege to use this syntax.
file_name cannot be an existing file, which among other things
prevents files such as /etc/passwd and database tables from being
destroyed. As of MySQL 5.0.19, the character_set_filesystem system
variable controls the interpretation of the filename.

Avoid the /etc/passwd line >:}

g.-

On 3/28/06, Christoph Frick <frick(at)sc-networks(dot)com> wrote:
> On Tue, Mar 28, 2006 at 11:49:16AM +0200, Andrea wrote:
>
> > I have both MySQL (5.0) and PostgreSQL (8.1) database servers on my PC.
> > On MySQL I have a table (very simple, only 7 char fields) filled with
> > about 35000 records. On PostgreSQL I have created the same table
> > structure (same fields, names, indexes, etc...). I would like to
> > transfer all records from MySQL to PostgreSQL. Which is the easiest
> > and shortest way to do this??
>
> dump the database with insert statements (maybe newer versions of
> mysqldump can also dump only one table's data), remove the stuff, that
> is not needed with postgres, fix the table names and so on with an
> editor of your choice and run the resulting file with psql.
>
> --
> cu
>
>
>

--
Guido Barosio
-----------------------

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Keith Worthington 2006-03-28 15:04:28 Change database encoding
Previous Message Andrea 2006-03-28 12:21:37 LIMIT clause and long timings