Open nlively opened 9 years ago
I've been continuing to research this and play around with the code. Seems like the problem goes away when the 'postgres-pr' gem is excluded from the Gemfile. Looks like these gems conflict in their definition of the PG namespace.
Can you create a Pull Request with the suggested fix?
+1, OSX, Yosemite, Ruby 2.1.7 / RVM
/Users/liltomato/.rvm/gems/ruby-2.1.7/gems/pg-0.18.4/lib/pg/connection.rb:230: warning: already initialized constant PGconn
/Users/liltomato/.rvm/gems/ruby-2.1.7/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:6: warning: previous definition of PGconn was here
/Users/liltomato/.rvm/gems/ruby-2.1.7/gems/pg-0.18.4/lib/pg/result.rb:26: warning: already initialized constant PGresult
/Users/liltomato/.rvm/gems/ruby-2.1.7/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:69: warning: previous definition of PGresult was here
/Users/liltomato/.rvm/gems/ruby-2.1.7@global/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:30:in `<top (required)>': '' does not exist (RuntimeError)
from /Users/liltomato/.rvm/rubies/ruby-2.1.7/bin/mysqltopostgres:23:in `load'
from /Users/liltomato/.rvm/rubies/ruby-2.1.7/bin/mysqltopostgres:23:in `<main>'
from /Users/liltomato/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `eval'
from /Users/liltomato/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `<main>'
+1
+1, OSX, Yosemite, Ruby 2.1.7 / RVM
Any updates on this?
WARN: Unresolved specs during Gem::Specification.reset:
test-unit (~> 2.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/Guillo/.rvm/gems/ruby-2.1.7/gems/pg-0.18.4/lib/pg/connection.rb:230: warning: already initialized constant PGconn
/Users/Guillo/.rvm/gems/ruby-2.1.7/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:6: warning: previous definition of PGconn was here
/Users/Guillo/.rvm/gems/ruby-2.1.7/gems/pg-0.18.4/lib/pg/result.rb:26: warning: already initialized constant PGresult
/Users/Guillo/.rvm/gems/ruby-2.1.7/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:69: warning: previous definition of PGresult was here
/Users/Guillo/.rvm/gems/ruby-2.1.7@global/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:30:in `<top (required)>': '' does not exist (RuntimeError)
from /Users/Guillo/.rvm/rubies/ruby-2.1.7/bin/mysqltopostgres:23:in `load'
from /Users/Guillo/.rvm/rubies/ruby-2.1.7/bin/mysqltopostgres:23:in `<main>'
from /Users/Guillo/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `eval'
from /Users/Guillo/.rvm/gems/ruby-2.1.7/bin/ruby_executable_hooks:15:in `<main>'
+1, thanks for ths repo!
I have a very similar issue on El Capitan
$ mysqltopostgres
/Users/samuelstickland/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4/lib/pg/connection.rb:230: warning: already initialized constant PGconn
/Users/samuelstickland/.rvm/gems/ruby-2.3.0/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:6: warning: previous definition of PGconn was here
/Users/samuelstickland/.rvm/gems/ruby-2.3.0/gems/pg-0.18.4/lib/pg/result.rb:26: warning: already initialized constant PGresult
/Users/samuelstickland/.rvm/gems/ruby-2.3.0/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:69: warning: previous definition of PGresult was here
/Users/samuelstickland/.rvm/gems/ruby-2.3.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:30:in `<top (required)>': '' does not exist (RuntimeError)
from /Users/samuelstickland/.rvm/gems/ruby-2.3.0/bin/mysqltopostgres:23:in `load'
from /Users/samuelstickland/.rvm/gems/ruby-2.3.0/bin/mysqltopostgres:23:in `<main>'
from /Users/samuelstickland/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/samuelstickland/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Same here
$ mysqltopostgres
/Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/lib/pg/connection.rb:230: warning: already initialized constant PGconn
/Library/Ruby/Gems/2.0.0/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:6: warning: previous definition of PGconn was here
/Library/Ruby/Gems/2.0.0/gems/pg-0.18.4/lib/pg/result.rb:26: warning: already initialized constant PGresult
/Library/Ruby/Gems/2.0.0/gems/postgres-pr-0.7.0/lib/postgres-pr/postgres-compat.rb:69: warning: previous definition of PGresult was here
/Library/Ruby/Gems/2.0.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:30:in `<top (required)>': '' does not exist (RuntimeError)
from /usr/local/bin/mysqltopostgres:23:in `load'
from /usr/local/bin/mysqltopostgres:23:in `<main>'
I get the same error as lucandrade.
All I can say is that Pull Requests are more than welcome, as I do not have the resources for doing this at the moment
Did anyone ever figure this out? Getting same error as @lucandrade
I followed the advice of removing references to the postgres-pr
gem, since I'm using MRI. (This fix won't work for JRUBY users, sowwy.)
See: https://github.com/brettimus/mysql2postgres/tree/issue_80_workaround
After hitting issue #73, was able to get it to work. (This comment had the fix that did the trick for me.)
Worth noting: if you run the command from your terminal, the "environment" defaults to "development". I.e., the script will try to access the postgres database defined under the development key in your config file. If you want to change that, you should specify a RAILS_ENV
variable.
E.g., running
RAILS_ENV=production mysqltopostgres config.yml
Would use the "production" database defined below:
mysql2psql:
mysql:
<<: *pii
destination:
production:
<<: *production
I'm using ruby 1.9.3-p551 with RVM on an OSX Yosemite installation. Keep running into this error:
Never seen that error before this task I'm doing, and I can't seem to find it referenced online.