Skip to content

Commit 598f5ea

Browse files
committed
Remove limitation
Tracks duckdb/duckdb#18480
1 parent 597e28b commit 598f5ea

1 file changed

Lines changed: 0 additions & 24 deletions

File tree

docs/current/sql/statements/insert.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -269,30 +269,6 @@ INSERT INTO tbl BY NAME
269269
ON CONFLICT DO UPDATE SET j = EXCLUDED.j;
270270
```
271271

272-
#### Limitations
273-
274-
When the `ON CONFLICT ... DO UPDATE` clause is used and a conflict occurs, DuckDB internally assigns `NULL` values to the row's columns that are unaffected by the conflict, then re-assigns their values. If the affected columns use a `NOT NULL` constraint, this will trigger a `NOT NULL constraint failed` error. For example:
275-
276-
```sql
277-
CREATE TABLE t1 (id INTEGER PRIMARY KEY, val1 DOUBLE, val2 DOUBLE NOT NULL);
278-
CREATE TABLE t2 (id INTEGER PRIMARY KEY, val1 DOUBLE);
279-
INSERT INTO t1
280-
VALUES (1, 2, 3);
281-
INSERT INTO t2
282-
VALUES (1, 5);
283-
284-
INSERT INTO t1 BY NAME (SELECT id, val1 FROM t2)
285-
ON CONFLICT DO UPDATE
286-
SET val1 = EXCLUDED.val1;
287-
```
288-
289-
This fails with the following error:
290-
291-
```console
292-
Constraint Error:
293-
NOT NULL constraint failed: t1.val2
294-
```
295-
296272
#### Composite Primary Key
297273

298274
When multiple columns need to be part of the uniqueness constraint, use a single `PRIMARY KEY` clause including all relevant columns:

0 commit comments

Comments
 (0)