Utility to Convert MySQL to PostgreSQL

Lists: pgsql-novice
From: "Michael Avila" <mavila(at)mich(dot)com>
To: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Utility to Convert MySQL to PostgreSQL
Date: 2005-07-24 16:59:48
Message-ID: NBBBLNPHAMCFENDFHIDCOEECEDAA.mavila@mich.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I've seen messages on the PostgreSQL website referring to a utility that
converts MySQL statements to PostgreSQL statements. I see that it is
convert(). However, there is no other indication on how it used or where it
is located. I looked in the PostgreSQL 8.0 docs and I could not find it. I
looked in the index for convert and found nothing.

I have a MySQL database table that uses auto increment and other
non-PostgreSQL statements so I would love an easy way to convert MySQL to
PostgreSQL statements and use PostgreSQL instead of MySQL in my project.
This project has the potential to be used throughout the US by volunteer
organizations so it is important that the database be $0, easy to use, and
interface with PHP. I am using a PHP add-in ADODB that should make the last
two easy. But I started the development in MySQL.

If anyone has any info about how to convert MySQL to PostgreSQL PLEASE let
me know!

Thanks.

Mike

Attachment Content-Type Size
winmail.dat application/ms-tnef 1.8 KB

From: John DeSoi <desoi(at)pgedit(dot)com>
To: Michael Avila <mavila(at)mich(dot)com>
Cc: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Utility to Convert MySQL to PostgreSQL
Date: 2005-07-24 17:16:54
Message-ID: 47F22035-FD8F-4449-9C10-10760E5FE753@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


On Jul 24, 2005, at 12:59 PM, Michael Avila wrote:

> If anyone has any info about how to convert MySQL to PostgreSQL
> PLEASE let
> me know!
>

I have not tried it, but there is such a utility here:

http://sqlfairy.sourceforge.net/

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Michael Avila <mavila(at)mich(dot)com>
Cc: Pgsql-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Utility to Convert MySQL to PostgreSQL
Date: 2005-07-24 17:26:11
Message-ID: 3aa53e256f8ca89562be917411b9debb@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


On Jul 24, 2005, at 1:16 PM, John DeSoi wrote:

>
> On Jul 24, 2005, at 12:59 PM, Michael Avila wrote:
>
> > If anyone has any info about how to convert MySQL to PostgreSQL 
> > PLEASE let
> > me know!
> >
>
> I have not tried it, but there is such a utility here:
>
> http://sqlfairy.sourceforge.net/

I have tried it, and it does about 99% of the job. There are a few
things that are MySQL version-dependent (added in later mysql versions)
that sqlfairy doesn't deal with appropriately, but those can usually be
dealt with by a simple find/replace in the word processor or a
perl/awk/sed script. If you are a perl user, sqlfairy is also called
SQL::Translator on cpan.

As an alternative, look in the postgresql distribution in
/contrib/mysql. There are two scripts for doing the conversion there.

Hope this helps.
Sean


From: "Michael Avila" <mavila(at)mich(dot)com>
To: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>, "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
Subject: Re: Utility to Convert MySQL to PostgreSQL
Date: 2005-07-25 00:58:35
Message-ID: NBBBLNPHAMCFENDFHIDCCEEEEDAA.mavila@mich.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

I have C:\Program Files\PostgreSQL\8.0\doc\contrib and C:\Program
Files\PostgreSQL\8.0\share\contrib but no folder mysql in either of them nor
a file with the name mysql in it.

Mike

-----Original Message-----
From: Sean Davis [mailto:sdavis2(at)mail(dot)nih(dot)gov]
Sent: Sunday, July 24, 2005 1:26 PM
To: Michael Avila
Cc: Pgsql-Novice
Subject: Re: [NOVICE] Utility to Convert MySQL to PostgreSQL

On Jul 24, 2005, at 1:16 PM, John DeSoi wrote:

>
> On Jul 24, 2005, at 12:59 PM, Michael Avila wrote:
>
> > If anyone has any info about how to convert MySQL to PostgreSQL 
> > PLEASE let
> > me know!
> >
>
> I have not tried it, but there is such a utility here:
>
> http://sqlfairy.sourceforge.net/

I have tried it, and it does about 99% of the job. There are a few
things that are MySQL version-dependent (added in later mysql versions)
that sqlfairy doesn't deal with appropriately, but those can usually be
dealt with by a simple find/replace in the word processor or a
perl/awk/sed script. If you are a perl user, sqlfairy is also called
SQL::Translator on cpan.

As an alternative, look in the postgresql distribution in
/contrib/mysql. There are two scripts for doing the conversion there.

Hope this helps.
Sean


From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: "Michael Avila" <mavila(at)mich(dot)com>, "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Utility to Convert MySQL to PostgreSQL
Date: 2005-07-25 02:48:46
Message-ID: 000801c590c3$6125b210$6401a8c0@WATSON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice


----- Original Message -----
From: "Michael Avila" <mavila(at)mich(dot)com>
To: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>; "Sean Davis"
<sdavis2(at)mail(dot)nih(dot)gov>
Sent: Sunday, July 24, 2005 8:58 PM
Subject: RE: [NOVICE] Utility to Convert MySQL to PostgreSQL

>I have C:\Program Files\PostgreSQL\8.0\doc\contrib and C:\Program
> Files\PostgreSQL\8.0\share\contrib but no folder mysql in either of them
> nor
> a file with the name mysql in it.

Ah, Windows. The scripts are in the source distribution in the
contrib/mysql directory, which may not be kept on Windows. I'm not sure
where (if anywhere) those end up in Windows. You can always just download
the source distro and get them from there. Again, the other alternative is
to use SQL::Translator, but I'm not sure about ActiveState availability....

Sean