#11964: Add the ability to use database-level CHECK CONSTRAINTS
-------------------------------------+-------------------------------------
     Reporter:  schinckel            |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  check contsraint     |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by rrauenza):

 Could/should this feature request also handle this case of constraint I
 brought up in this thread?

 https://code.djangoproject.com/ticket/11964

 Basically unique_together doesn't consider a null value unique per SQL
 spec -- which makes perfect sense in single column indexes and is extended
 to multi column indexes.

 So if someone wanted (A, B, NULL) to be a unique row there would need to
 be an index built on the first two columns "where <third column> is null"

 These SO articles give a better overview:

 http://stackoverflow.com/questions/17510261/django-unique-together-
 constraint-failure
 http://dba.stackexchange.com/questions/9759/postgresql-multi-column-
 unique-constraint-and-null-values

--
Ticket URL: <https://code.djangoproject.com/ticket/11964#comment:11>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.9b48132e69643cf4478ce8f09eb63ba5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to