#36592: Incorrect warning when specifying a UniqueConstraint with SQLite and
nulls_distinct=False
-------------------------------------+-------------------------------------
     Reporter:  Russell Owen         |                    Owner:  (none)
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  SQLite               |             Triage Stage:
  UniqueConstraint                   |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Russell Owen):

 I feel that you did not understand the point of my bug report (it's
 definitely not meant to be a proposal) and have closed it prematurely and
 unfairly.

 The bug is that one cannot construct a `UniqueConstraint` in sqlite if one
 specifies a boolean value for the `nulls_distinct` argument, even if the
 boolean value matches the behavior that sqlite supports. The only accepted
 value is None, and that is needlessly limiting.

 Based on the warning message that is printed, I believe that an explicit
 value of False should also be accepted. If I misunderstand and got the
 sign wrong, the bug still should be fixed. The *compatible* boolean value
 of `nulls_distinct` should be acceptable. It should result in the
 constraint being generated, without any warning.

 Use cases for specifying an explicit boolean value for `nulls_distinct`
 include:

 * Clarity: Maintainers can see the intended behavior.
 * Predictability. The behavior is known, instead of being a mysterious
 database-specific default.
 * Portability. The code will behave the same way when used with a
 different database (provided that database actually supports the specified
 mode).
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36592#comment:4>
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 visit 
https://groups.google.com/d/msgid/django-updates/0107019912f544c3-383e7f8c-6535-4fd6-9e6a-40bfc0d9be87-000000%40eu-central-1.amazonses.com.

Reply via email to