Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Ticket #2922 - Defining outer joins
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
  1 message - 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
 
Jonathan Buchanan  
View profile  
 More options Feb 1 2007, 8:54 am
From: "Jonathan Buchanan" <jonathan.bucha...@gmail.com>
Date: Thu, 1 Feb 2007 13:54:21 +0000
Local: Thurs, Feb 1 2007 8:54 am
Subject: Ticket #2922 - Defining outer joins
http://code.djangoproject.com/ticket/2922

Could I ask that the functionality proposed in this ticket be
reconsidered for inclusion?

I've encountered a situation where I need to be able to add an outer
join and *also* use the ON clause to specify conditions additional to
the primary key join generated when Q objects are used instead, as was
suggested in the thread [1] linked to with the ticket closing message.

I intended to use QuerySet's 'extra' method to add a 'direction'
property to all retrieved objects which indicated whether the current
user had voted the object up, down, or hadn't voted on the object at
all (to be used when displaying something like Reddit's voting
widgets, but in this case applicable to any model thanks to generic
views). Sample SQL is as follows:

SELECT aa.*, v.direction
FROM anyapp_anymodel aa
LEFT OUTER JOIN votes_vote v
  ON v.object_id = aa.id
  AND v.user_id = 2
  AND v.content_type_id = 15
WHERE aa.id = 1;

Putting the extra conditions in the WHERE clause instead results in a
row not being retrieved at all if the user hasn't voted on the object
it represents.

Thanks,
Jonathan.

[1] http://groups.google.com/group/django-developers/browse_thread/thread...


 
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 »