Re: Transfer from MySQL to PostgreSQL - Mailing list pgsql-novice

From Guido Barosio
Subject Re: Transfer from MySQL to PostgreSQL
Date
Msg-id f7f6b4c70603280422h75801566p14812970fdc4fa1c@mail.gmail.com
Whole thread Raw
In response to Re: Transfer from MySQL to PostgreSQL  (Christoph Frick <frick@sc-networks.com>)
Responses Re: Transfer from MySQL to PostgreSQL  (Bruce Momjian <pgman@candle.pha.pa.us>)
List 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@sc-networks.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
-----------------------

pgsql-novice by date:

Previous
From: Andrea
Date:
Subject: LIMIT clause and long timings
Next
From: "Keith Worthington"
Date:
Subject: Change database encoding