Loading topic
INSERT ... ON CONFLICT. The database can detect the conflict only when a constraint or index defines which values must be unique.2 min readSELECT, INSERT, and UPDATE statements. You should also know that a primary key identifies a row and that a unique constraint prevents duplicate values. The examples use PostgreSQL and can be run in psql or another PostgreSQL client.2 min readSELECT, INSERT, and UPDATE statements, primary keys, unique constraints, and how to run PostgreSQL statements from psql or another client.2 min readSELECT, INSERT, and UPDATE statements, primary keys, unique constraints, and how to run PostgreSQL statements in psql or another client.3 min readSELECT, INSERT, and UPDATE statements, primary keys, unique constraints, and how to run SQL in PostgreSQL.3 min readSELECT, INSERT, and UPDATE statements, along with primary keys and unique constraints. This chapter focuses on PostgreSQL's EXCLUDED row inside INSERT ... ON CONFLICT DO UPDATE.2 min readINSERT and UPDATE statements, primary keys, and unique constraints. It also assumes a product_stock table like this:2 min readINSERT, UPDATE, primary keys, and unique constraints. This chapter uses PostgreSQL's INSERT ... ON CONFLICT syntax.2 min readSELECT, INSERT, and UPDATE, and that product_stock.sku is a primary key or has a unique constraint. A multi-row upsert sends several proposed rows to PostgreSQL in one statement. PostgreSQL checks each row against the unique index and either inserts it, skips it, or updates t2 min readSELECT, INSERT, and UPDATE, and understand primary keys and unique constraints. You should also be able to run PostgreSQL statements in psql or another PostgreSQL client.3 min readSELECT, INSERT, and UPDATE, primary keys, unique constraints, and how to run PostgreSQL statements from psql or another client. The examples use PostgreSQL 15 or later, because MERGE was introduced in PostgreSQL 15.3 min readSELECT, INSERT, and UPDATE, and understand primary keys and unique constraints. This chapter focuses on behavior that can surprise you after an upsert appears to work.3 min read