Repository navigation
Conversation
233dc5b to
04e838b
Compare
|
Maybe I'm asking for too much, but can't we make an ideal and proper solution from the beginning and cover all exist drivers and database and resolve this issue forever? |
|
@pleerock That would be much better, indeed. I didn't want to change the codebase too much in order to avoid making the review time too painful. What would you recommend? Defining a dedicated method into Driver and overriding it in specific driver classes? |
|
If you are ready to start this refactoring for all drivers then see comment above ^ |
|
@pleerock Alright, I made a new commit (for the sake of an easier review) with a more generic approach. Let me know. Please also have a look at t4nz's comment about "alias collisions". Thanks |
|
Any news? I don't want to be rude but the ORM with Oracle is quite unusable right now |
vlapo
left a comment
There was a problem hiding this comment.
I really love these complex PRs for all drivers. We have to start do things right and not just fixing issues. Thnx a lot for this @VinceOPS.
I have just few comments about formating but I would love to see more tests not only for postgres but for all drivers and maybe more scenarios if it is possible. Could you please add tests e.g. in test/functional/query-builder/ test folder?
I'm in the same boat, our application is coming unstuck because of this issue. |
|
What is actually even more troubling, is that the relations which silently failed to be populated will overwrite values with |
This bug is causing data clobbering in our product. This is something you should be aware of, that under certain conditions this bug can lead to serious data corruption. Take for instance this scenario: If you deserialised this entity, and populating the |
|
Please DON'T CALL IT BUG. Because its not a BUG. Its how it is designed to work. Your statements can mislead other people. And I didn't get the actual answer to my question - how is your problem related to this PR? |
Pardon me, I thought I was commenting on the 'issue'. I think I ended up here following what I thought was a 'related issue' link. I understand what you mean now. |
|
@ajxs please create a new issue if you haven't yet and link all our conversations on this topic and lets continue discussion in there |
|
Great work guys! I stumbled onto this issue by hitting the postgres limitation. One question: if I understand the code correctly the Also, will this be merged only to |
|
Hi guys & sorry for the delay. I'm actually open for change requests and improvements, but I cannot test this feature for Oracle. At least I don't really have an interest/time in trying to make my workstation able to run Oracle and installing the drivers required to let the Node app connect to it... 🙄 EDIT - Don't want to look indelicate/rude so I'd rather be accurate: any help/commit/code change is most welcome regarding Oracle, if someone can/wants to do this part of the job. However I'd be glad to do whatever is required for MySQL & other DB systems "directly" available through the docker-compose. I can't reinvent the wheel or refactor too much code, though. I think I'd better fix only this issue 😅 😁 ... And we could create different PR's for pure-refactoring. |
Thats absolutely fine! Thank you for all the great job you already did. We all hate Oracle too. Please review all comments people did, see if you won't break anything, uncomment |
dbd6d7b to
9589bc4
Compare
|
Hi @pleerock I solved the branch conflicts and handled most of the comments. Two discussions are pending: The integration test has been left to "default drivers" and it helped me to notice an other issue: MySQL is throwing an error when trying to create a table whose name is longer than 64 characters (this was the case of the many-yo-many join-column, in my example). Thus, I had to apply the shortening logic to the table names too. I also added a test to check this behavior. All other tests passed too. Any comments are most welcome. |
0724743 to
b9d120e
Compare
|
@pleerock Should be fine now. Please let me know! |
|
there are some compiler errors ci fails because of them |
b9d120e to
6c9af3d
Compare
👌 |
|
Finally merged! Thank you very much for your hard work! |
|
Could this be merged also into next? |
|
I noticed that it's also a problem when getting relations. Specifically in the |
Hi there!
Context
I just made a small Pull request to address #3118. Postgres has a (built-in) limit of 63 characters for the name of columns and aliases used in SQL queries.
This prevent TypeORM from being able to properly transform raw results to Entities when querying "deeply nested" relations, as it can generate aliases as long as
"CategoryWithVeryLongName__postsWithVeryLongName__authorWithVeryLongName_firstName"(dummy example, but still 81 characters long).Thus, the "populated" (joined)
authorWithVeryLongNameis never converted from a raw result to an entity (and staysundefined).Solution
A similar issue has already been addressed for Oracle here by abbreviating the name of the selected column.
My concern with this code is that when
aliasis"CategoryWithVeryLongName__postsWithVeryLongName__authorWithVeryLongName"andcolumnNameis"firstName", abbreviating"firstName"to 2 characters might create collisions with other columns starting with"fi".That's why I decided to write
shorten, which is focused on shortening aliases.I also added a test which guarantees that
authorWithVeryLongNameis correctly loaded/instantiated as an entity.Why
Some E2E tests started failing in our application when this fix was introduced. Using
__instead of_(as a separator for the path of tables) lengthened the selection aliases.Any feedback is most welcome, this is only my second PR in the project. Thanks.