23505

מה אומרת שגיאת Postgres ‏(מסד הנתונים) הזאת

איך זה מופיע

duplicate key value violates unique constraint "<constraint_name>"

מה זה אומר

SQLSTATE 23505 is unique_violation: the row would repeat a value in a column, or set of columns, that must be unique, such as a primary key or an email column.

הסיבה הנפוצה באפליקציה שנבנתה עם AI

A common case is AI-written sign-up code that inserts a profile row for the new user while a database trigger has already created one, or code that runs insert on every sign-in instead of upsert.

בדקו את זה קודם

Note the constraint name in the error, then search the table for a row that already holds the value you tried to insert.

עוד קודים של Postgres ‏(מסד הנתונים)