On Sat, 2008-11-29 at 19:18 -0500, Michael Keselman wrote:
> Hey,
>       I wrote some middleware to track users, showing the time they were  
> last seen (see: http://dpaste.com/94701/ ). However, I noticed that  
> django produces a strange query of 'SELECT (1) AS "a" FROM  
> "users_userprofile" WHERE "users_userprofile"."id" = 1' whenever it  
> updates the profile. Am I doing something wrong?

No, you're not. That query is used whenever something is saved to
determine whether we do an update or an insert. If you issue an UPDATE
query when no row exists, nothing will be updated, which is almost
certainly not what you want and we don't bother with adding special
cases just for the databases that have some "update and create if not
there" option, since we try to use consistent portable SQL wherever
possible.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to