Re: migrating from mysql - Mailing list pgsql-general

From Dann Corbit
Subject Re: migrating from mysql
Date
Msg-id D425483C2C5C9F49B5B7A41F89441547055784@postal.corporate.connx.com
Whole thread Raw
In response to migrating from mysql  (Junaili Lie <junaili@gmail.com>)
List pgsql-general
1.  Create a script that creates the tables without RI stuff like
foreign keys and triggers.
2.  Import the data into the tables using COPY
3.  Create the RI stuff with 'alter table' and 'create trigger'
statements
http://www.postgresql.org/docs/current/static/sql-copy.html
http://www.postgresql.org/docs/current/static/sql-createtrigger.html
http://www.postgresql.org/docs/current/static/sql-altertable.html

As long as the original tables have no RI problems, and you load a
snapshot of the existing MySQL data, you should not have any problems.

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Junaili Lie
Sent: Wednesday, December 22, 2004 5:04 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] migrating from mysql

Hi everyone,
I am new to postgresql.
I am planning to migrate our current database (mysql) to posgresql. I
am currently having difficulties dealing with the order of the tables
that is created.
Here is what I do:
1. I use myqsldump to get the schema and data.
2. I use my2pg and a java utility I created to convert mysqldump to
sql statement that is understood by postgresql.
3. When populating the data to postgresql, it complained relation
"xxx" doesn't exist. This is the case because the table that is
refrenced has not been created.
The quick fix to this will be to change the sequence of the tables
that are created in such a way that tables that are being referenced
are first created before referencing table.
However, this is not practical if we have many tables.
My questions is: is there a way to get around this? is it possible to
disable checking for relation when creating a table that is
referencing to other tables?
I've searched around the internet and found somebody mentioning about
disable-fk-verifications, but I got an error (something like invalid
configuration parameters).
I am currently using postgresql 7.4.6.

Any ideas/suggestions is greatly appreciated.

J

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

pgsql-general by date:

Previous
From: Junaili Lie
Date:
Subject: migrating from mysql
Next
From: Tom Lane
Date:
Subject: Re: converting unique index into primary key