Skip to content

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

@sevenryze

Description

@sevenryze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions