#34943: Support passing unique constraint names to bulk_create(). -------------------------------------+------------------------------------- Reporter: Alex Vandiver | Owner: Sujay Type: New feature | Status: assigned Component: Database layer | Version: dev (models, ORM) | Severity: Normal | Resolution: Keywords: bulk insert update | Triage Stage: Accepted upsert | Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Alex Vandiver): It's worth noting that [PostgreSQL's `INSERT` documentation](https://www.postgresql.org/docs/current/sql-insert.html) suggests ''against'' `ON CONFLICT ON CONSTRAINT`, preferring the raw list of expressions: > It is often preferable to use unique index inference rather than naming a constraint directly using `ON CONFLICT ON CONSTRAINT constraint_name`. Inference will continue to work correctly when the underlying index is replaced by another more or less equivalent index in an overlapping way, for example when using `CREATE UNIQUE INDEX ... CONCURRENTLY` before dropping the index being replaced. That is, naming a specific constraint is in general more brittle, since it depends on the specific name, rather than naming the ''effect'' of the constraint. In our particular use case, we also currently only have a unique index, not a constraint -- and I'm not sure how well doing that migration would go. But that's a separate issue. -- Ticket URL: <https://code.djangoproject.com/ticket/34943#comment:6> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018b9555a1fd-fdf7e42d-c948-4fa7-9222-d999387ef831-000000%40eu-central-1.amazonses.com.