maxlapshin / mysql2postgres

Mysqldump, writing in postgresql format
MIT License
711 stars 156 forks source link

mediawiki conversion fails on first table #11

Closed simonwiles closed 8 years ago

simonwiles commented 14 years ago

Hi there :)

This looks like an extremely useful tool, but after fiddling around getting the necessary ruby environment configured (never really messed with Ruby before), I still can't get it to work.

I'm trying to convert a mediawiki installation, at the output is as follows:

Creating table archive...
Unknown {:auto_increment=>false, :type=>"varbinary(255)", :length=>255, :table_name=>"archive", :decimals=>nil, :null=>false, :name=>"ar_title", :primary_key=>false}
Unknown {:auto_increment=>false, :type=>"varbinary(255)", :length=>255, :table_name=>"archive", :decimals=>nil, :null=>false, :name=>"ar_user_text", :primary_key=>false}
Unknown {:auto_increment=>false, :type=>"binary(14)", :length=>14, :table_name=>"archive", :decimals=>nil, :null=>false, :name=>"ar_timestamp", :default=>"\000\000\000\000\000\000\000\000\000\000\000\000\000\000", :primary_key=>false}
Error:
CREATE TABLE "archive" (
  "ar_namespace" integer DEFAULT 0 NOT NULL,
  "ar_title" ,
  "ar_text" bytea NOT NULL,
  "ar_comment" bytea NOT NULL,
  "ar_user" integer DEFAULT 0 NOT NULL,
  "ar_user_text" ,
  "ar_timestamp" ,
  "ar_minor_edit" smallint DEFAULT 0 NOT NULL,
  "ar_flags" bytea NOT NULL,
  "ar_rev_id" integer,
  "ar_text_id" integer,
  "ar_deleted" smallint DEFAULT 0 NOT NULL,
  "ar_len" integer,
  "ar_page_id" integer,
  "ar_parent_id" integer
)
WITHOUT OIDS;
./mysql2psql:546:in `exec': ERROR:  syntax error at or near "," (PGError)
LINE 3:   "ar_title" ,
                     ^
    from ./mysql2psql:546:in `write_table'
    from ./mysql2psql:697:in `convert'
    from ./mysql2psql:696:in `each'
    from ./mysql2psql:696:in `convert'
    from ./mysql2psql:757

As I say, it took me a while to get the right environment to make it run (installed 3 different ruby/postgres implementations, before I found the right one), so perhaps I screwed that up?

Would be grateful for any advice. Thanks!

Edit: the three fields that have failed are blobs, 'mediumblob' and two 'tinyblob's respectively. is this script supposed to be able to handle blobs?

Edit again: Please ignore the above - it's total nonsense, I'm sorry. The fields which fail parsing are listed as types 'varbinary(255)', 'varbinary(255)' and 'binary(14)' respectively. Looking at the script, it's clear that these are unhandled.

I created a new mediawiki installation with a postgres backend, so that I could see how these fields are stored there. The varbinary fields are in the postgres schema as text fields, and the binary(14) are timestamps. So it seems I'm probably gonna have to roll my own solution to this anyway.

paazmaya commented 8 years ago

Closing as an old issue, that would seem to be out of date. Feel free to re-open and update with comments aganst the master branch.