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

fix: resolve issues ora-00972:identifier is too long #6591

Closed
wants to merge 2 commits into from

Conversation

MuratGundes
Copy link

Use index instead of parameter name for make it shorter alias name.

Closes: #5067

@pleerock
Copy link
Member

@imnotjames right now we have no idea if we can merge this small, but suspicious change because we have no oracle tests on CI running 😭

@imnotjames
Copy link
Contributor

imnotjames commented Aug 19, 2020

We can get them running - they weren't before because they were disabled & I think the Oracle image couldn't be pulled 'cause it's not free.

Happy to take a look at adding an oracle build to the mix - I was poking at it the other day but gave up because it just hasn't been running before.

I'll poke at it and update here + slack with more info.

@pleerock
Copy link
Member

@imnotjames thanks a lot

@MuratGundes
Copy link
Author

Thanks a lot guys! We will be appreciated.

@Rainson12
Copy link

merging this will be much appreciated it seems to be working for us and it seems like there is not other solution other than this to fix the issue with column& table names be longer than 30 characters. Its also not possible to shorten the column names as its a legacy system.

@imnotjames
Copy link
Contributor

imnotjames commented Aug 20, 2020 via email

@imnotjames
Copy link
Contributor

imnotjames commented Aug 23, 2020

Ok - issue with tests is that I had tried to spin up Oracle 11 - which typeorm doesn't support.

Still some issues with oracle either not being completely ready for tests or possibly crashing during the tests..

I'll continue on that some today.

imnotjames added a commit to imnotjames/typeorm that referenced this pull request Aug 26, 2020
@imnotjames
Copy link
Contributor

imnotjames commented Aug 27, 2020

Oracle tests seem to be working and they catch another spot where this happens -

return `${distinctAlias}.${columnAlias} as "ids_${DriverUtils.buildColumnAlias(this.connection.driver, mainAliasName, primaryColumn.databaseName)}"`;

The column alias can end up being 30 characters long because of the ids_ prefix. I'd fixed it by replacing it with:

https://github.com/imnotjames/typeorm/blob/build/oracle/src/query-builder/SelectQueryBuilder.ts#L1865-L1871

Same thing ALSO happens with table aliases - but I don't have a great solution for that.. That's a more in depth set of refactorings:

const froms = this.expressionMap.aliases

Still - different issue from this which is related to the parameter names rather than the identifiers generated

imnotjames added a commit to imnotjames/typeorm that referenced this pull request Aug 27, 2020
@imnotjames
Copy link
Contributor

imnotjames commented Sep 15, 2020

Should this instead be done similar to aliases? if > some predetermined driver specific length, hash it?

Like

if (maxAliasLength && maxAliasLength > 0 && columnAliasName.length > maxAliasLength) {
return hash(columnAliasName, { length: maxAliasLength });
}

@imnotjames
Copy link
Contributor

Also @MuratGundes please rebase against master - the tests for Oracle should run now :)

@imnotjames
Copy link
Contributor

Hey @MuratGundes - I'm gonna open another PR with these changes - the commits will have you as the author, but will be rebased against master so the oracle tests will run!

@pleerock
Copy link
Member

thank you @imnotjames it would be great if we can merge this one as fast as possible

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.

ORA-00972: identifier is too long on joins with FindOptions
4 participants