Re: Importing Mysql DUMPS into Postgresql

From: Vivek Khera <khera(at)kcilink(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Importing Mysql DUMPS into Postgresql
Date: 2001-08-02 18:10:29
Message-ID: x73d7anxii.fsf@onceler.kciLink.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "TG" == Thomas Glanzmann <tg(at)binary(dot)net> writes:

TG> This there a ready to use script available to import mysql dumps into
TG> postgresql?

Yes, but they are incomplete. You still have to massage your table
defs a bit to map to Postgres' way of life. Here are the notes I made
for myself when doing this.

change # comments to -- comments

change "int(10)" to "integer"

change "integer unsigned NOT NULL auto_increment" fields to type
"SERIAL PRIMARY KEY"

change "integer unsigned" to "integer check(colname >= 0)"

change "mediumtext" => "text"

remove "Type = XXX" table option at end of create statements.

change "timestamp(14)" => "timestamp default 'NOW()'" .. probably need
trigger to update this kind of timestamp on every update as well.

change "datetime" => "timestamp"

move "KEY" indexes after column create with CREATE INDEX

change "enum" fields to "varchar(X) check (fn in ('...','...'))"

change "set" fields to some type of text field, and make app convert
to/from comma separated string of values.

change "tinyint(N)" to "smallint"

change "UNIQUE KEY name" to "UNIQUE"

delete "binary" attributes to char fields.

delete any "default NULL" as they are redundant.

"text NOT NULL" needs to have "default ''" for same behavior as in mysql.

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera(at)kciLink(dot)com Rockville, MD +1-240-453-8497
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

Browse pgsql-general by date

  From Date Subject
Next Message Tara Cooper 2001-08-02 18:39:10 undeleteable records
Previous Message Vivek Khera 2001-08-02 18:07:52 Re: [HOW TO:] timestamp WITHOUT timezone