-
Notifications
You must be signed in to change notification settings - Fork 391
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 unless conflict on
on multi
pointers
#4907
Comments
This one will probably get fixed very soon (especially since it has a clear bug attached), but in the mean time, here is my general workaround for cases where you wish to use
The The idea here is that you aren't allowed to do DML (insert/update/delete) inside of a conditional (an (DML is not allowed in conditionals because there were concerns about both what the semantics should be and whether it was implementable, but the observation that |
And fix a bug where we could spuriously still raise an exception when using a bare UNLESS CONFLICT on a multi property conflict. Fixes #4907.
And fix a bug where we could spuriously still raise an exception when using a bare UNLESS CONFLICT on a multi property conflict. Fixes #4907.
And fix a bug where we could spuriously still raise an exception when using a bare UNLESS CONFLICT on a multi property conflict. Fixes #4907.
I think it wasn't originally implemented because it couldn't just be done using
ON CONFLICT
.But it turned out that a ton of stuff couldn't be implemented with just
ON CONFLICT
,and so we now have the "conflict CTE" mechanism that allows us to do unless conflict
style behavior in very flexible ways.
I think to make this work all we need to do is:
Looking at this I found an existing bug when there is an exclusive multi pointer and
UNLESS CONFLICT
with noON
is specified: the query is allowed, but can spuriously raise a constraint violation, because it does not properly choose to use conflict CTEs. But if some modification to the query is made that forces the use of conflict CTEs (such as another insert to the same type), then it works properly!The text was updated successfully, but these errors were encountered: