#31440 closed New feature (wontfix)
Add a standard way to set deferrable constraints.
Reported by: | Ian Foote | Owned by: | Ian Foote |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | constraints |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The behaviour of deferrable constraints (e.g. Foreign Key, Unique) in a transaction can be modified using the SET CONSTRAINTS
sql syntax (https://www.postgresql.org/docs/12/sql-set-constraints.html). Supporting this directly in Django will allow extra control over when IntegrityError
is raised.
Related to #20581.
Change History (5)
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
comment:2 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 5 years ago
Owner: | changed from | to
---|
comment:4 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Summary: | Add a standard way to set deferrable constraints → Add a standard way to set deferrable constraints. |
Thanks for this ticket, however you don't need to use a SET CONSTRAINTS
statements in most of transactions, usage is so niche that IMO it's acceptable to force users to call cursor.execute('SET CONSTRAINTS ...')
if they really need to. It's just not worth to maintain this hook. You can of course start a discussion on DevelopersMailingList if you don't agree.
comment:5 by , 5 years ago
I think this could be worth including, but I don't feel strongly enough about it right now.
Andy, sorry I didn't mention my previous work on this (see https://github.com/django/django/pull/10338#discussion_r276243141). If this ticket had been accepted, I'd have been happy for you to pick it up and finish it.
Andy, this ticket is not accepted. Moreover it looks that Ian already has a patch.