Skip to content

Conversation

geoffrey-eisenbarth
Copy link
Contributor

I've updated my older PR #156 to align with the recent psycopg changes. Where possible, I have utilized the approach taken by Django in queryset.bulk_create(), which supports upsert (see docs).

At the moment, specifying update_conflicts=True also requires explicitly setting drop_indexes=False and drop_constraints=False (since they are required by PostgreSQL to locate conflicting rows). This leads to a few options:

  1. Keep as is and require the user to be explicit in overriding the drop_indexes and drop_constraints defaults.
  2. Let update_conflicts=True override and set drop_indexes and drop_constraints to False.
  3. Change the default values of drop_indexes and drop_constraints, as discussed in drop indices/constraints default should be False #117.

Despite my comments in #117, I now have no preference among those options and would be happy to have it implemented any such way.

I'd be happy to answer any questions or implement any requested changes.

Merging this PR would close #91, #117 (possibly as "won't fix"), #122, and #168.

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

Successfully merging this pull request may close these issues.

Is ON CONFLICT DO UPDATE; possible?
1 participant