Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
#12598: somefield__isnull=False produce wrong SQL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Django  
View profile  
 More options Jan 12 2010, 7:37 pm
From: "Django" <nore...@djangoproject.com>
Date: Wed, 13 Jan 2010 00:37:51 -0000
Local: Tues, Jan 12 2010 7:37 pm
Subject: [Django] #12598: somefield__isnull=False produce wrong SQL
#12598: somefield__isnull=False produce wrong SQL
-----------------------------+--------------------------------------------- -
 Reporter:  benc             |       Owner:            
   Status:  new              |   Milestone:            
Component:  ORM aggregation  |     Version:  1.1      
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  0                |  
-----------------------------+--------------------------------------------- -
 Hi

 I have two models Model1 Model2, extending another model Model0(not
 abstract).
 I'm trying query Model0 and to filter only the models that have relation
 to Model1

 {{{
 objects = list(Model0.objects.filter(model2__isnull=False)
 }}}

 which result with a SQL

 {{{
 WHERE "myapp_model0"."id" IS NOT NULL
 }}}

 {{{
 objects = list(Model0.objects.filter(model2__isnull=True)
 }}}

 which result with a SQL

 {{{
 WHERE "myapp_model2"."model0_ptr_id" IS NULL'
 }}}

 The first SQL and the second is right.
 When using ~Q to negate the second I get what I want.

 Thanks

--
Ticket URL: <http://code.djangoproject.com/ticket/12598>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Django  
View profile  
 More options Jan 12 2010, 8:02 pm
From: "Django" <nore...@djangoproject.com>
Date: Wed, 13 Jan 2010 01:02:47 -0000
Local: Tues, Jan 12 2010 8:02 pm
Subject: Re: [Django] #12598: somefield__isnull=False produce wrong SQL
#12598: somefield__isnull=False produce wrong SQL
--------------------------------------+------------------------------------ -
          Reporter:  benc             |         Owner:    
            Status:  closed           |     Milestone:    
         Component:  ORM aggregation  |       Version:  1.1
        Resolution:  duplicate        |      Keywords:    
             Stage:  Unreviewed       |     Has_patch:  0  
        Needs_docs:  0                |   Needs_tests:  0  
Needs_better_patch:  0                |  
--------------------------------------+------------------------------------ -
Changes (by Alex):

  * status:  new => closed
  * needs_better_patch:  => 0
  * resolution:  => duplicate
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Dupe of #12567.

--
Ticket URL: <http://code.djangoproject.com/ticket/12598#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »