Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActiveRecord::ConnectionAdapters::OracleEnhanced::Connection::describe can fail for long table/view names #2343

Open
jmmorganMSTS opened this issue Jul 3, 2023 · 0 comments

Comments

@jmmorganMSTS
Copy link

Steps to reproduce

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?

System configuration

Rails version: 6.1.7.3

Oracle enhanced adapter version: 6.1.6

Ruby version: 2.7.0p0

Oracle Database version: 21xe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant