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;
Discussion 0
Join free to post in the discussion.
Related questions
- Durability in ACIDDatabase Administrator
- Logical vs physical backupDatabase Administrator
- Why a write-ahead log existsDatabase Administrator
- Read-only access for analystsDatabase Administrator
- What pg_hba.conf controlsDatabase Administrator
- View vs materialized viewDatabase Administrator
- What ROLLBACK undoesDatabase Administrator
- Seeing what is running nowDatabase Administrator