Skip to content
RED SAG Skills
mediumStudy question · answer published in PostgreSQL interview questions, so no pointstransactionsupsertpostgresql

RETURNING gives no row on conflict

Code runs the query below and reads id from the result. When the email already exists, the result is empty and the app crashes. Why?

INSERT INTO users (email) VALUES ($1)
ON CONFLICT (email) DO NOTHING
RETURNING id;
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions