maxlapshin / mysql2postgres

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

Odd error in the middle of loading a table #17

Closed mdotmoment11 closed 8 years ago

mdotmoment11 commented 13 years ago

In the middle of loading a table, the script threw this:

Loading mat_event... 520000 of 1351268 rows loaded. [ETA: 2010/09/28 11:08 (00h:01m:52s)]mysql2psql:360:in block in process_row': undefined methodhour' for nil:NilClass (NoMethodError) from mysql2psql:357:in each' from mysql2psql:357:ineach_with_index' from mysql2psql:357:in process_row' from mysql2psql:637:inblock in write_contents' from mysql2psql:241:in block in paginated_read' from mysql2psql:237:inupto' from mysql2psql:237:in paginated_read' from mysql2psql:635:inwrite_contents' from mysql2psql:692:in block in convert' from mysql2psql:691:ineach' from mysql2psql:691:in convert' from mysql2psql:750:in

'

Not sure what to make of it. Line 360 of that script looks pretty straightforward.

Thanks for the help.

maxlapshin commented 13 years ago

I will accept patch.

patjenk commented 13 years ago

I am receiving the same error with a similar stack trace. I can reproduce the error by trying to convert a mysql table with a time column that can be null and has a value of null. I have created a sample schema to assist anyone working on this bug (http://cl.ly/0Z193Q1c1z262H3Z2p3x/content). I am using the most recent mysql2postgres code on github.

-->mysql2psql /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_writer.rb:112:inprocess_row': undefined method hour' for nil:NilClass (NoMethodError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:ineach_with_index' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_writer.rb:109:in each' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_writer.rb:109:ineach_with_index' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_writer.rb:109:in process_row' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_file_writer.rb:129:inwrite_contents' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/mysql_reader.rb:191:in paginated_read' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/mysql_reader.rb:187:inupto' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/mysql_reader.rb:187:in paginated_read' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/postgres_file_writer.rb:127:inwrite_contents' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/converter.rb:33:in convert' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/converter.rb:31:ineach' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql/converter.rb:31:in convert' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/../lib/mysql2psql.rb:31:inconvert' from /usr/lib/ruby/gems/1.8/gems/mysql2psql-0.1.0/bin/mysql2psql:7 from /usr/bin/mysql2psql:19:in `load' from /usr/bin/mysql2psql:19

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.