Hey, I'm picking up this thread again--sorry for reviving a sleeper.
We're looking into doing this again for some much needed performance improvements. After looking at the feedback it looks like we would be able to deal with the created flag using the query status. https://www.postgresql.org/docs/9.5/static/sql-insert.html Down in the Outputs section is says: > If count is exactly one, and the target table has OIDs, then oid is the OID assigned to the inserted row. The single row must have been inserted rather than updated. Should be able to detect the presence of the OID in the output and set the created flag correctly. How exactly would I go about overwriting the get_or_create function? It looks like the get_or create is in the QuerySet object (https://github.com/django/django/blob/3c97ba2a0d3a03e89b27a7a895562e5282018613/django/db/models/query.py#L462-L475). And that that is returned in the base manager: https://github.com/django/django/blob/ed0ff913c648b16c4471fc9a9441d1ee48cb5420/django/db/models/manager.py#L146-L151 How would I go about overriding the base manager for postgres only? I don't see that class instantiated/implmented in the project anywhere. I'll admit, the github search is kinda lousy so I may have missed the spot. -Ben On Friday, January 8, 2016 at 4:13:26 PM UTC-8, bliy...@rentlytics.com wrote: > > Hey Guys, > > Postgres 9.5 has added the functionality for UPSERT aka update or insert. > Any interest in aligning UPSERT on the db layer with the get_or_create or > update_or_create functionality in django? Sounds like my company would be > interested in doing the work if the PR will get the traction. > > -Ben > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/5a5623ac-7b7d-432f-9a71-684f53a94168%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.