#28621: WHERE NOT EXISTS (... ~ ...) without extra() ?
--------------------------------+--------------------------------------
     Reporter:  Дилян Палаузов  |                    Owner:  nobody
         Type:  Uncategorized   |                   Status:  new
    Component:  Uncategorized   |                  Version:  1.11
     Severity:  Normal          |               Resolution:
     Keywords:  QuerySet.extra  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+--------------------------------------
Changes (by Дилян Палаузов):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 I get error:
 {{{
 In [7]:
 
A.objects.annotate(not_matches=~Exists(B.objects.annotate(tag=OuterRef('tag')).filter(tag__regex=F('pattern')))).filter(not_matches=True)
 ---------------------------------------------------------------------------
 AttributeError                            Traceback (most recent call
 last)
 <ipython-input-7-0a83a61e3d5b> in <module>()
 ----> 1
 
A.objects.annotate(not_matches=~Exists(B.objects.annotate(tag=OuterRef('tag')).filter(tag__regex=F('pattern')))).filter(not_matches=True)

 django/db/models/manager.py in manager_method(self, *args, **kwargs)
      83         def create_method(name, method):
      84             def manager_method(self, *args, **kwargs):
 ---> 85                 return getattr(self.get_queryset(), name)(*args,
 **kwargs)
      86             manager_method.__name__ = method.__name__
      87             manager_method.__doc__ = method.__doc__

 django/db/models/query.py in annotate(self, *args, **kwargs)
     946
     947         for alias, annotation in clone.query.annotations.items():
 --> 948             if alias in annotations and
 annotation.contains_aggregate:
     949                 if clone._fields is None:
     950                     clone.query.group_by = True

 AttributeError: 'ResolvedOuterRef' object has no attribute
 'contains_aggregate'
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28621#comment:2>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.9bee426177680cd9a92a45c02786bcb1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to