#36198: Unique Constraints defined with __date lookups on F expressions fail
validation but create database constraints sucessfully
-------------------------------------+-------------------------------------
     Reporter:  Tom Hall             |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  5.1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  constraint lookup    |             Triage Stage:  Accepted
  unique validation                  |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Tom Hall):

 Replying to [comment:3 Simon Charette]:
 > To me this is a duplicate or at least closely related to #34871 and is
 due to the fact that `models.F("timestamp__date")` is not turned into
 something alike `UnresolvedTransform(F("timestamp"), "date")` which would
 allow proper replacement of `F("timestamp")` by `Value(TIMESTAMP -
 dt.timedelta(days=1), DateLookup._meta.get_field("timestamp"))`.

 I did spot that one and meant to link to it in the description as maybe
 related but wasn't familiar ~~enough~~ at all with the underlying
 mechanics to be confident. And then I forgot. First time here and getting
 used to the system. Nice work on fixing it up, I suspected something in
 `F.replace_expressions` was needed.

 Can try writing something up for the docs to demonstrate this being used
 if that would be helpful?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36198#comment:7>
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/010701951b3c5a3b-7b92445d-a1e8-461d-9e2c-9a1acfa9927e-000000%40eu-central-1.amazonses.com.

Reply via email to