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
with no RETURNING *. The UpdateResult doesn't contain the updated record from the DB and in my testing it's always completely empty:
{generatedMaps: [],raw: []}
so even if the error wasn't occurring, I wouldn't be able to send a return object with the new updatedAt value or any other DB-calculated values back to the client without performing a subsequent SELECT
The text was updated successfully, but these errors were encountered:
by using update instead of save you disable lot of orm functionality, not just disabling additional select.
when you use @UpdateDateColumn typeorm suppose to manage its date on its own. If you don't need it - just create a regular column and update its date when you need it.
I expected to see the query like: UPDATE "pizza" SET "name" = $2, "updatedAt" = CURRENT_TIMESTAMP WHERE "id" = $1 RETURNING *
some people can expect returning, some not. But update doesn't tell anything about returning - it just tells that it updates. That's why you don't have anything in returning result.
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[x]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[ ]
latest
[ ]
@next
[x]
0.2.11
(or put your version here)Related to:
#3271
Steps to reproduce or a small repository showing the problem:
I recently switched our update method to use
repository.update()
instead ofrepository.save()
to prevent the needless extraSELECT
beforeUPDATE
.pizza-route.ts
I was surprised by two things:
multiple assignments to same column \"updatedAt\"
.I thought adding the
readonly
flag:would fix the problem, but the
repository.update()
method appears to ignore thereadonly
flag for theUpdateDateColumn()
andCreateDateColumn()
.repository.update()
method does not give access to the updated DB value likerepository.save()
does. I expected to see the query like:but the query was
with no
RETURNING *
. TheUpdateResult
doesn't contain the updated record from the DB and in my testing it's always completely empty:so even if the error wasn't occurring, I wouldn't be able to send a return object with the new
updatedAt
value or any other DB-calculated values back to the client without performing a subsequentSELECT
The text was updated successfully, but these errors were encountered: