Bugs item #12508, was opened at 2007-07-23 18:50
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=12508&group_id=2014
Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: When creating table aliases for included tables, names are not
truncated for oracle
Initial Comment:
When there are multiple includes for relationships to the same table, the alias
created for the tables should have its name truncated in oracle.
For example
class ObjectOne < ActiveRecord::Base
belongs_to :really_cool_object_two, :class_name => 'ObjectTwo' , :foreign_key
=> 'cool_object_two'
belongs_to :really_not_cool_object_two, :class_name => 'ObjectTwo' ,
:foreign_key => 'not_cool_object_two'
end
class ObjectTwo < ActiveRecord::Base
end
if we do ObjectOne.find(:all, :include => [:really_cool_object_two,
:not_cool_object_two])
the sql for will be
SELECT * --some stuff actually
FROM object_ones
LEFT OUTER JOIN object_twos ON object_twos.id =
object_ones.cool_object_two
LEFT OUTER JOIN object_twos really_not_cool_object_two_object_ones ON
really_not_cool_object_two_object_ones = object_ones.not_cool_object_two
This is not correct and will cause a "ORA-00972: identifier is too long" in
oracle. Using the regular active record oracle we would get the table alais
truncated.
----------------------------------------------------------------------
>Comment By: Ola Bini (olabini)
Date: 2007-08-11 15:40
Message:
It should be added to somewhere in the JdbcSpec::Oracle module.
----------------------------------------------------------------------
Comment By: Matt Field (bonfigleo)
Date: 2007-07-23 20:36
Message:
Adding the following to the JdbcAdaptor class fixes this problem for oracle.
This is obviously not the right place to do it or it needs some conditional
logic.
def table_alias_length
30
end
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=12508&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel