SQLite Forum

upsert-clause ON CONFLICT Railway Diagram
Login
The railway diagram on <https://www.sqlite.org/syntax/upsert-clause.html>
(and corresponding documentation at <https://www.sqlite.org/lang_upsert.html>) implies that the brackets with the column names can be left out, i.e. "ON CONFLICT DO UPDATE column = value" is a valid upsert-clause.

In practice, this does not work. You get an "Error: near "UPDATE": syntax error". To make it work you have to specify the relevant columns. So that clause like "ON CONFLICT (indexedcolumn) DO UPDATE column = value" works. Interestingly "ON CONFLICT DO NOTHING" works as described.

So I think this is a bug and either the documentation needs to be changed or the implementation needs to be fixed to conform to the documentation. Looking forward to your feedback.

Marcel

### To reproduce run the following in a new SQLite DB:

```
INSERT INTO foobar (a, b) VALUES (1, 1) ON CONFLICT DO UPDATE SET a = 2;
```

### Result:

```
Error: near "UPDATE": syntax error
```

### Expected:

```
Error: no such table: foobar
```

### Version

SQLite Version: SQLite version 3.31.1 2020-01-27 19:55:54  
OS: Linux 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux