Skip to content

Fix unique constraint crash when same attachment is passed twice#1366

Open
Bortlesboat wants to merge 1 commit intosimonw:mainfrom
Bortlesboat:fix-duplicate-attachment-constraint
Open

Fix unique constraint crash when same attachment is passed twice#1366
Bortlesboat wants to merge 1 commit intosimonw:mainfrom
Bortlesboat:fix-duplicate-attachment-constraint

Conversation

@Bortlesboat
Copy link

Summary

  • Adds ignore=True to the prompt_attachments insert in log_to_db, so duplicate (response_id, attachment_id) pairs are silently skipped instead of raising sqlite3.IntegrityError
  • Adds a test that passes the same file attachment twice and verifies no crash

Closes #1354

Use ignore=True when inserting into prompt_attachments so that
duplicate (response_id, attachment_id) pairs are silently skipped
instead of raising sqlite3.IntegrityError.

Closes simonw#1354
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled sqlite unique constraint violation when --attachment is passed twice on the same file

1 participant