Skip to content

[BUG] InsertOnConflictDoNothing returns wrong error on Create failure #6889

@cuiweixie

Description

@cuiweixie

Problem

In collectionDb.InsertOnConflictDoNothing, when GORM Create fails (tx.Error != nil), the code logged zap.Error(err) and returned err. The named return err is not assigned from the transaction in this path, so callers may receive nil or a stale value instead of the actual database error.

Expected

Log and return tx.Error (the GORM error from the failed Create).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions