create table a_table_or_view_name_longer_than_thirty_characters ( id number );
create table a_short_table_or_view_name ( id number );
Run in rails console:
ApplicationRecord.connection; nil # pre-connect
class TestModel < ApplicationRecord
self.table_name = 'a_table_or_view_name_longer_than_thirty_characters'
end
TestModel # failes
class TestModel2 < ApplicationRecord
self.table_name = 'a_table_or_view_name_longer_than_thirty_characters'.upcase
end
TestModel2 # works with .upcase
class TestModel3 < ApplicationRecord
self.table_name = 'a_short_table_or_view_name'
end
TestModel3 # works without .upcase
Expected behavior
ActiveRecord models with table_name larger than 30 characters should return results when the name is all lowercase.
Actual behavior
Accessing the model results in the error:
ActiveRecord::ConnectionAdapters::OracleEnhanced::ConnectionException ("DESC a_table_or_view_name_longer_than_thirty_characters" failed; does it exist?)
I believe this is being caused by a 29 + 1 character limit in the regexp used by ActiveRecord::ConnectionAdapters::OracleEnhanced::Quoting::valid_table_name?
Steps to reproduce
Run in
rails console
:Expected behavior
ActiveRecord models with table_name larger than 30 characters should return results when the name is all lowercase.
Actual behavior
Accessing the model results in the error:
I believe this is being caused by a 29 + 1 character limit in the regexp used by
ActiveRecord::ConnectionAdapters::OracleEnhanced::Quoting::valid_table_name?
System configuration
Rails version: 6.1.7.3
Oracle enhanced adapter version: 6.1.6
Ruby version: 2.7.0p0
Oracle Database version: 21xe