I'm trying to learn postgresql's upsert syntax but I keep getting this error:
ERROR: syntax error at or near "name"
LINE 5: SET name = EXCLUDED.name;
this is the sql statement:
INSERT INTO users (name, fav_num)
VALUES ('bob', 2)
ON CONFLICT (id) DO UPDATE
SET fav_num = EXCLUDED.fav_num,
SET name = EXCLUDED.name;
I tried changing the excluded.fav_num and excluded.name to values but I still encounter the same error. I'm running PostgreSQL 10.6. What should be the proper query?
Table:
|------|------|---------|
| id | name | fav_num |
|------|------|---------|
| 1 | bob | 1 |
|------|------|---------|