Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update all columns on conflict #238

Open
go-jet opened this issue May 19, 2023 Discussed in #237 · 0 comments
Open

How to update all columns on conflict #238

go-jet opened this issue May 19, 2023 Discussed in #237 · 0 comments

Comments

@go-jet
Copy link
Owner

go-jet commented May 19, 2023

Discussed in #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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant