You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
save() method, if getting object with id attribute, using it for SELECT query, but ignoring for INSERT
Expected Behavior
expacted behaviour isthat entry will be inserted withh allattributes passed, including id, meaning, if I save following object {id: 5, name: "test"} produced SQL will be
SELECT id, name FROM some_table WHERE id=5
and if not found INSERT INTO some_table (id, name) VALUES(5, "test")
Actual Behavior
currentlywhile first SELECt query produced as expected, second INSERT query missing id field and interted and lastinsert sequence and not at place expected, query looks like INSERT INTO some_table (name) VALUES("test")
Issue description
save() method, if getting object with id attribute, using it for SELECT query, but ignoring for INSERT
Expected Behavior
expacted behaviour isthat entry will be inserted withh allattributes passed, including id, meaning, if I save following object
{id: 5, name: "test"}
produced SQL will beSELECT id, name FROM some_table WHERE id=5
INSERT INTO some_table (id, name) VALUES(5, "test")
Actual Behavior
currentlywhile first SELECt query produced as expected, second INSERT query missing id field and interted and lastinsert sequence and not at place expected, query looks like
INSERT INTO some_table (name) VALUES("test")
Steps to reproduce
pseudo code
const saveObject = {id: 5, name: "test"}
await queryRunner.manager.save(SomeEntity, saveObject);
My Environment
Additional Context
tested on postgres, but may be relevant to all drivers
Relevant Database Driver(s)
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
The text was updated successfully, but these errors were encountered: