Skip to content

Maximum length of a table name in Oracle NONQUOTED_OBJECT_NAME #2423

@Faq

Description

@Faq

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions