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

Support upsert conflicts for non-unique columns #15

Open
ad-si opened this issue Jun 6, 2024 · 0 comments
Open

Support upsert conflicts for non-unique columns #15

ad-si opened this issue Jun 6, 2024 · 0 comments

Comments

@ad-si
Copy link
Member

ad-si commented Jun 6, 2024

From docs (https://www.sqlite.org/lang_upsert.html):

The UPSERT processing happens only for uniqueness constraints. A "uniqueness constraint" is an explicit UNIQUE or PRIMARY KEY constraint within the CREATE TABLE statement, or a [unique index](https://www.sqlite.org/lang_createindex.html#uniqueidx).

I wonder if we should also support it for other columns. This would then be executed by the server, since SQLite doesn’t support it. Basically if insert causes an error, run:

UPDATE "users"
SET name = 'Marc'
WHERE name == 'John'

(Must be one transaction)

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