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

Repository.save() doesn't not check id correctly when id is buffer type. #3654

Closed
sevenryze opened this issue Feb 16, 2019 · 3 comments
Closed

Comments

@sevenryze
Copy link
Contributor

Issue type:

[ ] question
[*] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[x] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

  1. Use buffer as the id type. Define column type to binary.
  2. Add new entity into db and read it, then update it's field.
  3. Invoke the save() method of the entity repository.
  4. The save() is always INSERT a new entity, which cause duplication on primary constrains check.
  5. Then, change id type to string type. The save() works as normal, UPDATE.

I guess we maybe not implement the proper buffer compare logic, as only compare the object/string etc. currently.

@sevenryze
Copy link
Contributor Author

I can confirm the conjecture i have made and will send a PR to fix this bug soon.

Feel free to test and merge this PR.

@sevenryze
Copy link
Contributor Author

This bug will be fixed in #3655.
Do anyone have questions?

@sevenryze
Copy link
Contributor Author

PR is merged and this issue should be closed.

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

No branches or pull requests

1 participant