rake db:migrate not working on my postgres db
Ok so i have a rails application that I am attempting to run the migrations on a postgres db and I usually use mysql and all is good but when i run the command i get this
rake db:migrate
(in /Users/tamer/Sites/my_app)
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
-- control frame ----------
c:0058 p:---- s:0215 b:0215 l:000214 d:000214 CFUNC :exec
c:0057 p:0040 s:0211 b:0211 l:000191 d:000210 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0056 p:0005 s:0208 b:0208 l:000198 d:000207 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.r
c:0055 p:0032 s:0206 b:0206 l:000205 d:000205 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21
c:0054 p:0052 s:0199 b:0199 l:000198 d:000198 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.r
c:0053 p:0018 s:0192 b:0192 l:000191 d:000191 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0052 p:0013 s:0187 b:0187 l:000186 d:000186 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0051 p:0011 s:0184 b:0184 l:000183 d:000183 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0050 p:0136 s:0180 b:0180 l:000179 d:000179 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0049 p:0131 s:0177 b:0177 l:000176 d:000176 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0048 p:0054 s:0174 b:0174 l:000173 d:000173 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0047 p:---- s:0167 b:0167 l:000166 d:000166 FINISH
c:0046 p:---- s:0165 b:0165 l:000164 d:000164 CFUNC :new
c:0045 p:0186 s:0158 b:0158 l:000157 d:000157 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter
c:0044 p:0045 s:0149 b:0149 l:000148 d:000148 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0043 p:0011 s:0146 b:0146 l:000145 d:000145 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0042 p:0048 s:0142 b:0142 l:000128 d:000141 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0041 p:---- s:0139 b:0139 l:000138 d:000138 FINISH
c:0040 p:---- s:0137 b:0137 l:000136 d:000136 CFUNC :loop
c:0039 p:0009 s:0134 b:0134 l:000128 d:000133 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0038 p:0019 s:0132 b:0132 l:000131 d:000131 METHOD /Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201
c:0037 p:0013 s:0129 b:0129 l:000128 d:000128 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0036 p:0030 s:0126 b:0123 l:000122 d:000122 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0035 p:0033 s:0120 b:0120 l:000119 d:000119 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0034 p:0018 s:0115 b:0115 l:000114 d:000114 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0033 p:0011 s:0112 b:0112 l:000111 d:000111 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connectio
c:0032 p:0020 s:0109 b:0109 l:000108 d:000108 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:486
c:0031 p:---- s:0103 b:0103 l:000102 d:000102 FINISH
c:0030 p:---- s:0101 b:0101 l:000100 d:000100 CFUNC :new
c:0029 p:0020 s:0095 b:0095 l:000094 d:000094 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433
c:0028 p:0083 s:0090 b:0090 l:000089 d:000089 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:415
c:0027 p:0102 s:0085 b:0085 l:000d58 d:000084 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:142
c:0026 p:---- s:0083 b:0083 l:000082 d:000082 FINISH
c:0025 p:---- s:0081 b:0081 l:000080 d:000080 CFUNC :call
c:0024 p:0043 s:0076 b:0076 l:000067 d:000075 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:636
c:0023 p:---- s:0073 b:0073 l:000072 d:000072 FINISH
c:0022 p:---- s:0071 b:0071 l:000070 d:000070 CFUNC :each
c:0021 p:0171 s:0068 b:0068 l:000067 d:000067 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:631
c:0020 p:0110 s:0064 b:0064 l:000058 d:000063 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:597
c:0019 p:0019 s:0062 b:0062 l:000061 d:000061 METHOD /Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201
c:0018 p:0033 s:0059 b:0059 l:000058 d:000058 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:590
c:0017 p:0048 s:0053 b:0053 l:000052 d:000052 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:583
c:0016 p:0045 s:0048 b:0048 l:000047 d:000047 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2051
c:0015 p:0012 s:0041 b:0041 l:000026 d:000040 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2029
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :each
c:0012 p:0069 s:0033 b:0033 l:000026 d:000032 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2029
c:0011 p:0009 s:0031 b:0031 l:000030 d:000030 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/airbrake-3.0.9/lib/airbrake/rake_handler.rb:33
c:0010 p:0011 s:0027 b:0027 l:000026 d:000026 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2023
c:0009 p:0029 s:0024 b:0024 l:000017 d:000023 BLOCK /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2001
c:0008 p:0009 s:0022 b:0022 l:000021 d:000021 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2068
c:0007 p:0011 s:0018 b:0018 l:000017 d:000017 METHOD /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:1998
c:0006 p:0036 s:0015 b:0015 l:000014 d:000014 TOP /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/bin/rake:31
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :load
c:0003 p:0127 s:0007 b:0007 l:0014e8 d:000f40 EVAL /Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/bin/rake:19
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0014e8 d:0014e8 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/bin/rake:19:in `<main>'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/bin/rake:19:in `load'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/airbrake-3.0.9/lib/airbrake/rake_handler.rb:33:in `standard_exception_handling'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:415:in `migrate'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433:in `up'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:433:in `new'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/migration.rb:486:in `initialize'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:316:in `retrieve_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:93:in `connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in `checkout'
/Users/tamer/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `block in checkout'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `loop'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `block (2 levels) in checkout'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout_new_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:228:in `new_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in `postgresql_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:25:in `new'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:228:in `initialize'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:939:in `connect'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:956:in `configure_connection'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:278:in `set_standard_conforming_strings'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:699:in `client_min_messages'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:483:in `query'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:195:in `log'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activesupport-3.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:197:in `block in log'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487:in `block in query'
/Users/tamer/.rvm/gems/ruby-1.9.2-p290@my_app/gems/activerecord-3.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:487:in `exec'
-- C level backtrace information -------------------------------------------
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap
My database.yml file looks like this
development:
encoding: unicode
adapter: postgresql
username: postgres
port: 5432
host: localhost
database: test
password: password
Any idea what i am doing wrong..these are the correct credentials because i conntect to this postgres db with a GUI tool with these creds
I used this link to install the pg gem
Given that you got an actual segmentation fault, I'd bet on a problem with your pg gem in conjunction with libpg. Did you by any chance upgrade your OS lately?
If this seems like a reasonable thing, you might try saving a backup of your database, nuking your existing pg installation (database, libraries and gems), then reinstalling it all in hopes of getting rid of whatever incompatibilities are causing the problem.
I have mysql and postgresql database in the same application. Here are the steps which i have followed to set up the postgresql database.
sudo apt-get install postgresql postgresql-contrib libpq-dev
sudo -u postgres createuser --superuser $USER
or sudo -u postgres createuser pgs_root
sudo -u postgres psql postgres ( For psql prompt)
postgres=# password <user>
for ex.- postgres=# passsword pgs_root
listen_addresses = 'localhost'
In order for your application to connect with database present in PostgreSQL, configure it in the database.yml
development_postgres: adapter: postgresql database: connect_postgres username: pgs_root password: root123 host: 127.0.0.1
rake db:create RAILS_ENV=development_postgres
Like mysql query browser, there is a GUI for postgresql called pgadmin. To install
sudo apt-get install pgadmin3
I would try the following:
I have had issues where my pg gem is not the right version for my version of rails
链接地址: http://www.djcxy.com/p/57558.html上一篇: 多线程性能和性能分析