[v10.0.x] SQLStore: Align SQLite IsUniqueConstraintViolation() with other backend implementations (#69227)

SQLStore: Align SQLite IsUniqueConstraintViolation() with other backend implementations (#69224)

* Add integration test for primary key and unique constrain violation

* Align SQLite IsUniqueConstraintViolation implementation with other backends

(cherry picked from commit 74e87ccbbd)

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2023-05-29 17:55:35 +03:00
committed by GitHub
co-authored by Sofia Papagiannaki
parent 9df2e093b1
commit a81452b437
2 changed files with 53 additions and 1 deletions
@@ -148,7 +148,7 @@ func (db *SQLite3) ErrorMessage(err error) string {
}
func (db *SQLite3) IsUniqueConstraintViolation(err error) bool {
return db.isThisError(err, int(sqlite3.ErrConstraintUnique))
return db.isThisError(err, int(sqlite3.ErrConstraintUnique)) || db.isThisError(err, int(sqlite3.ErrConstraintPrimaryKey))
}
func (db *SQLite3) IsDeadlock(err error) bool {