# Postgres error 42P10: there is no unique or exclusion constraint matching the ON CONFLICT specification

> An upsert names conflict columns that do not have a unique index or constraint.

Source: https://scribase.com/postgres-errors/42p10

SQLSTATE class: Syntax Error or Access Rule Violation. Over PostgREST/supabase-js this maps to HTTP 400.

## Causes

- ON CONFLICT (email) without a unique index on email.
- A unique index that is partial or uses an expression (lower(email)) that the ON CONFLICT clause does not repeat.

## Fixes

- Create the unique index: create unique index on users (email);
- Repeat the index expression or predicate in ON CONFLICT ((lower(email))) or ON CONFLICT (...) WHERE ....

In supabase-js, .upsert(rows, { onConflict: 'email' }) needs a unique index on email.