Issue with Arel::SelectManager and insert Method


Arel::SelectManager (arel 2.0.9) uses following statement to insert a
new record:

@engine.connection.insert im.to_sql, 'AREL', primary_key_name,

But in DatabaseStatements insert ist defined as:

insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)

Actually, Arel::SelectManager does not use the sequence name. This
leads to issues for instance with
activerecord-jdbc-adapter and Oracle, when you use sequence names
ignoring rails conventions.

Is it possible to fix this issue?


Can you provide a test case to reproduce the problem? We run a CI
against Oracle, and all the tests are green. If you could give us a
test to show the problem, I could fix it.

class MyModel < ActiveRecord::Base
  set_table_name "some_table_name"
  set_sequence_name "my_sequnce_name"
end => 1, attr2 => 2).save!

leads to a exception. With:

jruby 1.6.1
gem 'rails', '3.0.7'
gem 'activerecord-jdbc-adapter', '1.1.1'

In this case prefetch_primary_key? returns false.
So the insert method in activerecord-jdbc-adapter-1.1.1/lib/arjdbc/
oracle/adapter.rb needs the sequence-name to determine the next id,
but arel doesn't use this
parameter. Without a sequence-name the default sequence-name
table_name_id is
used. This sequence doesn't exists.