jet icon indicating copy to clipboard operation
jet copied to clipboard

How to update all columns on conflict

Open go-jet opened this issue 1 year ago • 0 comments

Discussed in https://github.com/go-jet/jet/discussions/237

Originally posted by rsmidt May 17, 2023 I'm trying to implement a basic upsert where I want to update all fields as soon as I hit a constraint, e.g.

Users.
	INSERT(Users.AllColumns).
	MODEL(user).
	ON_CONFLICT(Users.ID).
	DO_UPDATE(
		SET(Users.AllColumns.SET(Users.EXCLUDED.AllColumns)),
	)

Unfortunately, this doesn't compile. Am I doing something wrong here? Is there maybe a better way to achieve the upsert?

go-jet avatar May 19 '23 12:05 go-jet