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

Address ORA-00972: identifier is too long when tested with Oracle #16167

Merged
merged 1 commit into from
Jul 14, 2014

Conversation

yahonda
Copy link
Member

@yahonda yahonda commented Jul 14, 2014

This pull request address the following error since #15343 has been merged to master.
Because the max identifier length of Oracle is limited to 30 bytes.

This pull request uses shorter name by renaming polymorphic to poly only for attribute names which is over 30 bytes.

$ cd activerecord
$ rake test_oracle
... snip ...
stmt.c:230:in oci8lib_210.so: OCIError: ORA-00972: identifier is too long: CREATE TABLE "FACES" ("ID" NUMBER(38) NOT NULL PRIMARY KEY, "DESCRIPTION" VARCHAR2(255), "MAN_ID" NUMBER(38), "POLYMORPHIC_MAN_ID" NUMBER(38), "POLYMORPHIC_MAN_TYPE" VARCHAR2(255), "POLYMORPHIC_MAN_WITHOUT_INVERSE_ID" NUMBER(38), "POLYMORPHIC_MAN_WITHOUT_INVERSE_TYPE" VARCHAR2(255), "HORRIBLE_POLYMORPHIC_MAN_ID" NUMBER(38), "HORRIBLE_POLYMORPHIC_MAN_TYPE" VARCHAR2(255)) (ActiveRecord::StatementInvalid)
... snip ...
rake aborted!

@@ -1,7 +1,7 @@
class Face < ActiveRecord::Base
belongs_to :man, :inverse_of => :face
belongs_to :polymorphic_man, :polymorphic => true, :inverse_of => :polymorphic_face
belongs_to :polymorphic_man_without_inverse, :polymorphic => true
belongs_to :poly_man_without_inverse, :polymorphic => true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth a comment here, so it doesn't get changed back to the more "natural" spelling?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick update. I was thinking to change without to wo but it did not satisfy 30 bytes length, Also thinking about to change inverse to invrs but it looked more unclear. As long as it can be 30 byte or less, whichever name is fine for me. If you have some suggestions for alternative, it would be very appreciated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with this name... I just think we should add a comment to this line, noting that the name needs to be less than 25 characters for Oracle.

yahonda referenced this pull request Jul 14, 2014
…nverse_of

prevent bad automatic inverse_of association
@yahonda
Copy link
Member Author

yahonda commented Jul 14, 2014

@matthewd Updated with comments, then squashed my commit.

matthewd added a commit that referenced this pull request Jul 14, 2014
Address ORA-00972: identifier is too long when tested with Oracle
@matthewd matthewd merged commit 55c1b1d into rails:master Jul 14, 2014
@yahonda yahonda deleted the ora972_faces branch July 14, 2014 14:05
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.

None yet

2 participants