Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: MysQL to Postgres
11-08-2007, 03:35 PM #1
- Join Date
- Aug 2006
- Thanked 110 Times in 109 Posts
MysQL to Postgres
I have spent months developing a MySQL DB only to find that the sys admin of the project only uses postgres. So now I have to migrate to Postgres. Any ideas for saving time?You can not say you know how to do something, until you can teach it to someone else.
11-13-2007, 12:58 AM #2
So what's the problem? They're basically the same.
id INT NOT NULL PRIMARY KEY auto_increment becomes id SERIAL NOT NULL PRIMARY KEY
you have to use triggers on insert to emulate INSERT ... ON DUPLICATE KEY UPDATE ...
Users who have thanked ralph l mayo for this post:
11-13-2007, 01:40 AM #3
- Join Date
- Sep 2005
- Thanked 36 Times in 35 Posts
postgres won't like any backticks you might have (`s), and if your export from mysql contains anything referencing table-types (myisam, innodb) lose them as postgres doesn't have such a concept
The best thing is to install postgres, try and import the export you've done from mysql and see what doesn't work- there shouldn't be anything (much?) that won't work, once you've got an error-free import.
With postgres, DDL operations ('create table' etc.), are revert-able when inside a transaction, so when doing the imports using 'begin;' and 'commit;
will make the trial+error process a bit easier.