Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 79577bf

Browse files
committed
Better log message when encountering duplicate
Logs the detail of the pg error, which will include the time and series id of the duplicate.
1 parent 291e86d commit 79577bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/pgmodel/pgx.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ func tryRecovery(conn pgxConn, req copyRequest, insertFn insertionFunction, err
689689
// if we have duplicate data points try again using
690690
// INSERT ... ON CONFLICT DO NOTHING to insert only the new ones
691691
if pgErr.Code == pgerrcode.UniqueViolation {
692-
log.Warn("msg", fmt.Sprintf("duplicate data in sample for %s", req.table), "table", req.table)
692+
log.Warn("msg", fmt.Sprintf("duplicate data in sample for %s", req.table), "detail", pgErr.Detail, "table", req.table)
693693
req.data.batch.ResetPosition()
694694
return doInsert, nil
695695
}

0 commit comments

Comments
 (0)