I have a table structured with columns user_id, item_id, test
I'd like to make an INSERT/UPDATE query so that if the passed in user_id and item_id combination is already found in a row of the table, it just updates the test of that row. I've tried the following query but it doesn't work:
INSERT INTO tableName (user_id, item_id, test)
VALUES($1, $2, $3)
ON CONFLICT ON CONSTRAINT UNIQUE(user_id, item_id)
DO UPDATE SET test = ($3)
This doesn't work. I've tried playing around with DISTINCT keyword as well but didn't manage to get it working correctly. Any help much appreciated!