in reply to Looking to convert all my MySQL DB's to postgresql, any experiences with mysql2pgsql?

My advice is: do the schema conversion by hand, figure out the correct options for mysqldump to get postgres-compatible output, and pipe it to psql (within a single transaction).

Leave the inter-table constraints out of the schema and add them only after you have the data in.

Of course, the schema conversion part is a tad difficult if you're not familiar with postgres's data types.

  • Comment on Re: Looking to convert all my MySQL DB's to postgresql, any experiences with mysql2pgsql?
  • Download Code

Replies are listed 'Best First'.
Re^2: Looking to convert all my MySQL DB's to postgresql, any experiences with mysql2pgsql? (sqlt)
by Anonymous Monk on Nov 27, 2013 at 07:44 UTC

    Of course, the schema conversion part is a tad difficult if you're not familiar with postgres's data types.

    sqlt / http://sqlfairy.sourceforge.net/ *magically* converts from schemas to schemas

    sqlt -f MySQL -t PostgreSQL < in.mysql > out.postgresql sqlt --from MySQL --to PostgreSQL < in.mysql > out.postgresql sqlt --parser MySQL --producer PostgreSQL < in.mysql > out.postgresql
      LOL
      Funny you bring that Module up. After posting this topic, I went on a hunt to see if there might be something better, and landed on exactly that same Module.

      Thanks :)

      --Chris

      #!/usr/bin/perl -Tw
      use Perl::Always or die;
      my $perl_version = (5.12.5);
      print $perl_version;
Re^2: Looking to convert all my MySQL DB's to postgresql, any experiences with mysql2pgsql?
by taint (Chaplain) on Nov 27, 2013 at 14:30 UTC
    Good advice.
    Thanks for the words of caution.

    --Chris

    #!/usr/bin/perl -Tw
    use Perl::Always or die;
    my $perl_version = (5.12.5);
    print $perl_version;