[Rails] Re: Postgres adapter misconfigured on Linux?
No Postgres adapter was broken. It turns out that another developer had installed the postgres_ext gem, which doesn't support add_index. Removing that gem fixed the failures.
On Tuesday, July 23, 2013 4:21:52 PM UTC-4, Benjamin Nash wrote:
--I've written a simple Rails migration that adds an index to an existing Postgres table:class AddIndexToEvents < ActiveRecord::Migration
def change
add_index :sf_events, :account_id
end
endHowever, when I run the migration, it fails due to a syntax error on the CREATE INDEX line. I'm expecting some SQL like this to be generated:CREATE INDEX index_sf_events_on_account_id ON sf_events (account_id);But instead I get something like this:CREATE INDEX index_sf_events_on_account_id ON sf_events ( );The migration works fine on my friend's Mac, but it fails on my Linux box. It seems like I may have the wrong/outdated packages. I'm running Ubuntu 12.10 and have these packages installed: libpq-dev, libpq5, postgresql, postgresql-9.1, postgresql-client-9.1, postgresql-client-common,postgresql-common, postgresql- contrib, postgresql-contrib-9. 1. Here's the full error message:== AddIndexToEvents: migrating ===============================================
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: syntax error at or near ")"
LINE 1: ...ATE INDEX "index_sf_events_on_account_id" ON "sf_events"( )
^
: CREATE INDEX "index_sf_events_on_account_id" ON "sf_events"( )/home/ben/.rvm/gems/ruby-1.9. 3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/postgresql_adapter. rb:650:in `async_exec'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/postgresql_adapter. rb:650:in `block in execute'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/abstract_adapter.rb: 280:in `block in log'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activesupport-3.2.13/ lib/active_support/ notifications/instrumenter.rb: 20:in `instrument'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/abstract_adapter.rb: 275:in `log'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/postgresql_adapter. rb:649:in `execute'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/postgres_ext-0.4.0/ lib/postgres_ext/active_ record/connection_adapters/ postgres_adapter.rb:326:in `add_index'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/pg_power-1.5.0/lib/ pg_power/create_index_ concurrently.rb:82:in `add_index'
/home/ben/git/workbench-api/db/migrate/20130723195953_add_ index_to_events.rb:3:in `change'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:407:in `block (2 levels) in migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:407:in `block in migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/abstract/connection_ pool.rb:129:in `with_connection'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:389:in `migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:528:in `migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:720:in `block (2 levels) in migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:775:in `call'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:775:in `block in ddl_transaction'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/connection_ adapters/abstract/database_ statements.rb:192:in `transaction'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/ transactions.rb:208:in `transaction'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:775:in `ddl_transaction'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/pg_power-1.5.0/lib/ pg_power/create_index_ concurrently.rb:201:in `ddl_transaction_with_ postponed_queries'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:719:in `block in migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:700:in `each'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:700:in `migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:570:in `up'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/migration. rb:551:in `migrate'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/gems/activerecord-3.2.13/ lib/active_record/railties/ databases.rake:193:in `block (2 levels) in <top (required)>'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:246:in `call'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:246:in `block in execute'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:241:in `each'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:241:in `execute'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:184:in `block in invoke_with_call_chain'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:177:in `invoke_with_call_chain'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ task.rb:170:in `invoke'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:143:in `invoke_task'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:101:in `block (2 levels) in top_level'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:101:in `each'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:101:in `block in top_level'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:110:in `run_with_threads'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:95:in `top_level'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:73:in `block in run'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:160:in `standard_exception_handling'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@global/ gems/rake-10.0.4/lib/rake/ application.rb:70:in `run'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/bin/ruby_noexec_wrapper: 14:in `eval'
/home/ben/.rvm/gems/ruby-1.9.3-p392-railsexpress@workbench- api/bin/ruby_noexec_wrapper: 14:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ba11dc80-3424-4f95-b6d5-c119384ce4af%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home