Error code

PostgreSQL 23505

POSTGRESQL23505
Database Error Code· An error code returned by a database server such as PostgreSQL or MySQL.

What it means

unique_violation — a row with this key already exists.

How to fix it

  1. Check the existing row before inserting and use INSERT ... ON CONFLICT DO UPDATE or DO NOTHING.
  2. Remove or change the conflicting value in the new row.
  3. Verify that application logic deduplicates records upstream before writing to the database.

Not affiliated with PostgreSQL. Answer summarized from the manufacturer's manual linked above; consult that source for the authoritative procedure.