mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
Remove duplicate key violation from idempotent error patterns
"duplicate key value violates" on CREATE UNIQUE INDEX means the index can't be created due to duplicate data — this is NOT idempotent. Marking it as applied silently skips index creation, leaving the DB without the unique constraint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fdd8a706ba
commit
85e28c9f31
2 changed files with 3 additions and 4 deletions
|
|
@ -230,7 +230,6 @@ class ProxyExtrasDBManager:
|
|||
idempotent_patterns = [
|
||||
r"already exists",
|
||||
r"column .* already exists",
|
||||
r"duplicate key value violates",
|
||||
r"relation .* already exists",
|
||||
r"constraint .* already exists",
|
||||
r"does not exist",
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ class TestIdempotentErrorDetection:
|
|||
error_message = "column 'email' already exists"
|
||||
assert ProxyExtrasDBManager._is_idempotent_error(error_message) is True
|
||||
|
||||
def test_is_idempotent_error_duplicate_key(self):
|
||||
"""Test detection of duplicate key violation error"""
|
||||
def test_duplicate_key_violation_not_idempotent(self):
|
||||
"""Duplicate key violations (e.g., CREATE INDEX with duplicate data) are NOT idempotent"""
|
||||
error_message = "duplicate key value violates unique constraint"
|
||||
assert ProxyExtrasDBManager._is_idempotent_error(error_message) is True
|
||||
assert ProxyExtrasDBManager._is_idempotent_error(error_message) is False
|
||||
|
||||
def test_is_idempotent_error_relation_already_exists(self):
|
||||
"""Test detection of 'relation already exists' error"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue