oracle-enhanced icon indicating copy to clipboard operation
oracle-enhanced copied to clipboard

Maximum length of a table name in Oracle NONQUOTED_OBJECT_NAME

Open Faq opened this issue 11 months ago • 0 comments

This looks outdated: https://github.com/rsim/oracle-enhanced/blob/master/lib/active_record/connection_adapters/oracle_enhanced/quoting.rb#L40

In Oracle 12.2 and above the maximum object name length is 128 bytes.

In Oracle 12.1 and below the maximum object name length is 30 bytes. Source https://stackoverflow.com/questions/756558/what-is-the-maximum-length-of-a-table-name-in-oracle

For 19c NONQUOTED_OBJECT_NAME constant with regex prevented connection to the table with the name length more than 30 bytes, and returned default defined ORA-04043 error. Had to use this in initializer:

module ActiveRecord
    module ConnectionAdapters
      module OracleEnhanced
        module Quoting
          NONQUOTED_OBJECT_NAME = /[A-Za-z][A-z0-9$#]{0,127}/
          VALID_TABLE_NAME = /\A(?:#{NONQUOTED_OBJECT_NAME}\.)?#{NONQUOTED_OBJECT_NAME}(?:@#{NONQUOTED_DATABASE_LINK})?\Z/
        end
      end
    end
  end

Faq avatar Jan 29 '25 07:01 Faq