-
Notifications
You must be signed in to change notification settings - Fork 4
Rails 4.0.2 + trinidad_postgresql_dbpool_extension error #12
Comments
Thanks Michael, will look at this - likely to be fixed on AR-JDBC's side ... could we see your Gemfile ? |
Gemfile shown below. We were previously using AR-JDBC 1.2.9 with rails 3.2, but 1.2.9 is not compatible with Rails 4. Here is the gemfile: source 'http://gems.moneydesktop.com'
source 'https://rubygems.org'
# Rails and its supporting gems
gem 'rails', '4.0.2'
# Private gems (#mdtech represent!)
gem 'active_remote_pagination', '~> 0.3.0' # 0.4 added Celluloid, which doesn't work with Sync::Remote.
gem 'atlas'
gem 'babou'
gem 'buttress'
gem 'lockout'
gem 'minimus'
gem 'rack-strong_routes'
# Public gems
gem 'active_remote'
gem 'redis-rails'
gem 'protected_attributes'
gem 'safe_yaml'
gem 'sidekiq'
# JRuby-specific gems
platforms :jruby do
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3'
gem 'json'
# Use Trinidad as the app server
gem 'trinidad'
gem 'trinidad_postgresql_dbpool_extension'
end
# MRI-specific gems
platforms :ruby do
gem 'pg'
gem 'oj'
# Use Unicorn as the app server
gem 'unicorn'
end
# Deploy it with Trebuchet
gem 'trebuchet', :group => :development
# Get it running with Foreman
gem 'foreman', :require => false
# So we have it when we need it
gem 'pry-nav', :group => [ :development, :test, :sandbox, :qa ]
# Test it with RSpec
gem 'rspec-rails', :group => [ :development, :test ]
group :development do
gem 'md-yard'
gem 'thin', :platform => :ruby
end
group :test do
gem 'factory_girl_rails'
gem 'md_smoke', :require => 'smoke'
gem 'protobuf-rspec'
gem 'rspec-pride'
gem 'shoulda'
gem 'simplecov', :require => false
gem 'testarossa'
gem 'timecop'
end |
you can confirm it's an AR-JDBC regression if you disable |
I set prepared_statements: false for both config/database.yml and in my trinidad.yml where I load the postgresql_dbpool extension, but I still get the same exception. Looks like in activerecord-jdbc-adapter 1.3.3 the call sight is in lib/arjdbc/postgresql/adapter.rb line 1102. def table_exists?(name)
schema, table = extract_schema_and_table(name.to_s)
return false unless table # abstract classes - nil table name
binds = [[ nil, table.gsub(/(^"|"$)/,'') ]]
binds << [ nil, schema ] if schema
sql = <<-SQL
SELECT COUNT(*) as table_count
FROM pg_tables
WHERE tablename = ?
AND schemaname = #{schema ? "?" : "ANY (current_schemas(false))"}
SQL
log(sql, 'SCHEMA', binds) do
@connection.execute_query_raw(sql, binds).first["table_count"] > 0
end
end Calling execute_query_raw would seem like it is already bypassing the prepared statement stuff? |
definitely an AR-JDBC issue ... should be fixed in next release please track at jruby/activerecord-jdbc-adapter#515 thx! |
I am upgrading a rails 3.2 app to rails 4.0.2 with trindad and jdbcpostgresql.
When the first activerecord model gets required and it uses the table_exists? to check for table existence I get the failure: 'Java::JavaLang::ClassCastException: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to org.postgresql.PGConnection'
This only occurs when using the trinidad_postgresql_dbpool_extension.
Here is a more complete stack trace.
Is this a known issue with Rails 4? I'm happy to come up with a minimal reproducible if this is unknown territory.
The text was updated successfully, but these errors were encountered: