fix(postgres): one isUniqueViolation after merging the EDA and status lanes

This commit is contained in:
sam committed 2026-09-24 02:33:52 +10:00
1 parent ecc1997384
commit f3a1ef6de1
1 file changed
-13
@@ -14,7 +14,6 @@ import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/samcharles93/archie-core/internal/domain/binding"
@@ -521,18 +520,6 @@ func ledgerWrite(err error, what string) error {
}
}
// isUniqueViolation reports whether err is a PostgreSQL unique-index refusal,
// detected by SQLSTATE 23505 rather than by matching the driver's error text.
// A Postgres error whose message happens to say "unique" but whose SQLSTATE is
// something else must not be treated as one.
func isUniqueViolation(err error) bool {
var pgErr *pgconn.PgError
if !errors.As(err, &pgErr) {
return false
}
return pgErr.Code == "23505"
}
// --- tool calls ---
// InsertToolCall appends one row to the tool_calls transcript.