Upsert SQL query throwing error with golang and squirrel. SQL error at or near where

1.2k Views Asked by At

sql err: 'pq: syntax error at or near "WHERE"', sql: 'INSERT INTO table (id,user,type) VALUES ($1,$2,$3) ON CONFLICT WHERE id = $4 AND user = $5 DO UPDATE SET type = $6', params: [3 158 up 3 158 up]

Using the info on this page, I thought I could chain together an INSERT statement with an ON CONFLICT clause such that if user and id were found in the same row of the table, update that row instead. Where is the syntax error mentioned above?

0

There are 0 best solutions below