/** PostgreSQL unique_violation (23505), including Drizzle's wrapped cause shape. */ export function isPostgresUniqueError(error: unknown): boolean { let current: unknown = error; for (let depth = 0; current && depth < 5; depth += 1) { if ((current as { code?: string }).code === "23505") return true; current = (current as { cause?: unknown }).cause; } return false; }