Fix more LastInsertId calls (#101892)

* Fix more places where LastInsertId is used without proper directive for Spanner.

* Fix tests.
This commit is contained in:
Peter Štibraný
2025-03-11 09:03:03 +01:00
committed by GitHub
parent 11a95a0b80
commit fa809ac417
3 changed files with 13 additions and 7 deletions
+4
View File
@@ -374,6 +374,10 @@ func (sl *ServerLockService) createLock(ctx context.Context,
}
lockRow.Id = id
} else {
if sl.SQLStore.GetDBType() == migrator.Spanner {
rawSQL += " THEN RETURN id" // Required for successful LastInsertId call.
}
res, err := dbSession.Exec(
rawSQL,
lockRow.OperationUID, lockRow.LastExecution, 0)