-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ON CONFLICT specify Action #2602
Comments
For now you would have to use a function for this. To be able to do this directly we could extend the POST /characters?on_conflict.action=update&on_conflict.columns=letter |
Or as suggested on #2066, we could set Prefer: resolution=merge-duplicates;columns=col1,col2,col3 That seems simpler to implement. To make it clearer it could also be: Prefer: on-conflict=update;columns=col1,col2,col3 This looks even clearer Prefer: resolution=merge-duplicates;update-set=col1,col2,col3 |
We could also try to combine this with #465. Prefer: resolution=merge-duplicates;col1=set.col1;col2=set.col2;col3=set.col3
Prefer: resolution=merge-duplicates;col1=set.excluded.col1;col2=set.excluded.col2;col3=set.excluded.col3 It's longer to type but it would support using operators and other things that |
Wondering if there's any plan to support the new MERGE DML command: https://www.postgresql.org/docs/current/sql-merge.html? |
Unfortunately MERGE does not support RETURNING, yet. And it won't support it in v16 either. That means we can't run it in a CTE. This makes it currently impossible to use it in our queries. I do use MERGE in |
@wolfgangwalther Hm, why do you use MERGE in those cases? From what I see here: There are also perf advantages when sticking to INSERT ON CONFLICT. |
In the cases where I use it, I do have a Non-issue in my use-cases.
Do you have data backing that up? |
I'm trying to specify an action when handling on conflict that doesn't
merge-duplicates
. For example, I have the following:I have a
post
request as follows:So the result would be:
I tried looking through the documentation, but could only find an example for
merge-duplicates
, which would overwrite the other fields.Is there a way to specify the action?
THANKS!
Related
The text was updated successfully, but these errors were encountered: