Skip to content

Support longer identifier for Oracle database 12.2 or higher #1703

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

Merged
merged 1 commit into from
Apr 16, 2018

Conversation

yahonda
Copy link
Collaborator

@yahonda yahonda commented Apr 16, 2018

Longer identifier has been supported by aliasing table_alias_length and index_name_length method defined in ActiveRecord::ConnectionAdapters::OracleEnhanced::DatabaseLimits to use max_identifier_length method newly creted in ActiveRecord::ConnectionAdapters::OracleEnhanced::OracleEnhancedAdapter. Because ActiveRecord::ConnectionAdapters::OracleEnhanced::DatabaseLimits does not know the database version.

Refer
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/Database-Object-Names-and-Qualifiers.html#GUID-75337742-67FD-4EC0-985F-741C93D918DA

Not implemented in this commit:

  • Support longer identifiers for column name, sequence name
  • Use 30 byte identifier for Oracle database 12.2 for those who prefer old behavior.

Addresses #1594

Longer identifier has been supported by aliasing `table_alias_length`
and `index_name_length` method defined in `ActiveRecord::ConnectionAdapters::OracleEnhanced::DatabaseLimits`
to use `max_identifier_length` method newly creted
in `ActiveRecord::ConnectionAdapters::OracleEnhanced::OracleEnhancedAdapter`.
because ActiveRecord::ConnectionAdapters::OracleEnhanced::DatabaseLimits does not know the database version.

Refer
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/Database-Object-Names-and-Qualifiers.html#GUID-75337742-67FD-4EC0-985F-741C93D918DA

Not implemented in this commit:
* Support longer identifiers for column name, sequence name
* Use 30 byte identifier for Oracle database 12.2 for those who prefer old behavior.

Addresses rsim#1594
@yahonda yahonda merged commit 1bed3fd into rsim:master Apr 16, 2018
@yahonda yahonda deleted the longer_identifier branch April 16, 2018 15:37
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Apr 16, 2018
to support shorter 30 bytes identifier for Oracle 12.2 or higher

Follows up rsim#1703
yahonda added a commit to yahonda/rails that referenced this pull request Mar 3, 2019
```ruby
$ ARCONN=oracle bin/test test/cases/migration/columns_test.rb -n test_rename_column_with_multi_column_index
... snip ...

F

Failure:
ActiveRecord::Migration::ColumnsTest#test_rename_column_with_multi_column_index [/home/yahonda/git/rails/activerecord/test/cases/migration/columns_test.rb:113]:
--- expected
+++ actual
@@ -1 +1 @@
-["i_test_models_hat_style_size"]
+["index_test_models_on_hat_style_and_size"]

```

Kind of reverting rails#9395
Refer rsim/oracle-enhanced#1703
koic added a commit to koic/oracle-enhanced that referenced this pull request Jan 19, 2021
…higher

Follow rsim#1703.

Oracle enhanced adapter supports longer identifier by rsim#1703.
I encountered the following error when using `rename_table` in Oracle 12c.

```console
New table name 'identifier_of_thirty_bytes_or_more' is too long; the limit is 30 characters
```

Because `IDENTIFIER_MAX_LENGTH` constant was fixed to 30 bytes.

This PR will use `max_identifier_length` method instead of the constant and
accept longer identifier (max 128 bytes) when using Oracle 12.2 or higher.

I encountered the error in Rails 6.0. So I'd like a backport to 6.1 and 6.0 stable branches.
koic added a commit to koic/oracle-enhanced that referenced this pull request Jan 19, 2021
…higher

Follow rsim#1703.

Oracle enhanced adapter supports longer identifier by rsim#1703.
I encountered the following error when using `rename_table` in Oracle 12c.

```console
New table name 'identifier_of_thirty_bytes_or_more' is too long; the limit is 30 characters
```

Because `IDENTIFIER_MAX_LENGTH` constant was fixed to 30 bytes.

This PR will use `max_identifier_length` method instead of the constant and
accept longer identifier (max 128 bytes) when using Oracle 12.2 or higher.

I encountered the error in Rails 6.0. So I'd like a backport to 6.1 and 6.0 stable branches.
koic added a commit to koic/oracle-enhanced that referenced this pull request Jan 19, 2021
…higher

Follow rsim#1703.

Oracle enhanced adapter supports longer identifier by rsim#1703.
I encountered the following error when using `rename_table` in Oracle 12c.

```console
New table name 'identifier_of_thirty_bytes_or_more' is too long; the limit is 30 characters
```

Because `IDENTIFIER_MAX_LENGTH` constant was fixed to 30 bytes.

This PR will use `max_identifier_length` method instead of the constant and
accept longer identifier (max 128 bytes) when using Oracle 12.2 or higher.

I encountered the error in Rails 6.0. So I'd like to backport to 6.1 and 6.0 stable branches.
koic added a commit to koic/oracle-enhanced that referenced this pull request Jan 19, 2021
…higher

Follow rsim#1703.

Oracle enhanced adapter supports longer identifier by rsim#1703.
I encountered the following error when using `rename_table` in Oracle 12c.

```console
New table name 'identifier_of_thirty_bytes_or_more' is too long; the limit is 30 characters
```

Because `IDENTIFIER_MAX_LENGTH` constant was fixed to 30 bytes.

This PR will use `max_identifier_length` method instead of the constant and
accept longer identifier (max 128 bytes) when using Oracle 12.2 or higher.

I encountered the error in Rails 6.0. So I'd like to backport to 6.1 and 6.0 stable branches.
koic added a commit to koic/oracle-enhanced that referenced this pull request Jan 19, 2021
…higher

Follow rsim#1703.

Oracle enhanced adapter supports longer identifier by rsim#1703.
I encountered the following error when using `rename_table` in Oracle 12c.

```console
New table name 'identifier_of_thirty_bytes_or_more' is too long; the limit is 30 characters
```

Because `IDENTIFIER_MAX_LENGTH` constant was fixed to 30 bytes.

This PR will use `max_identifier_length` method instead of the constant and
accept longer identifier (max 128 bytes) when using Oracle 12.2 or higher.

I encountered the error in Rails 6.0. So I'd like to backport to 6.1 and 6.0 stable branches.
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

Successfully merging this pull request may close these issues.

1 participant