First steps in converting MySQL data to PostgreSQL

Yesterday I installed PostgreSQL using Fink. I could have chosen to download and install the .dmg from Enterprisedb but that one gave me some troubles (might be the machine I am using for development).

Today I started to look in converting my MySQL data to PostgreSQL. It seems there is a tool called mysql2pgsql. It converts a dump file into a format postgres can read. Once run you will have translated auto_increment fields for a primary key to sequences:

CREATE SEQUENCE “tcms_content_id_seq”  START WITH 786 ;

CREATE TABLE  “tcms_content” (
“id” integer DEFAULT nextval(‘”tcms_content_id_seq”‘) NOT NULL,
“content”   text NOT NULL,
“page_id” int CHECK (“page_id” >= 0) NOT NULL,
primary key (“id”)
)   ;

I was able to import it into PostgreSQL and using pgAdmin it shows the constraints, tables, etc..

The next time I will work on tcms I will start translating the php code to connect to PostgreSQL and see what will need to be altered.


Tagged: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: