I was reviewing all the SQL calls in my page views by taking advantage
of the context variable "sql_queries" when DEBUG=True.
I found this query that isn't quoted correctly (I trimmed out some
stuff to make this shorter):
SELECT
-- various fields listed here
FROM
`page_content`
INNER JOIN
`page_attribute`
AS `page_content__attribute`
ON `page_content`.`attribute_id` = `page_content__attribute`.`id`
WHERE
(
`page_content`.`page_id` = 78
AND `page_content__attribute`.`name` = Alt Page Title
)
ORDER BY
`page_content`.`sequence` ASC
LIMIT 1
In the WHERE clause, page_content__attribute.name argument should be
quoted but it's not. If I run this manually I get an SQL error.
The Python line is this (which is wrapped in a try block in case we
get an IndexError:
title = next_page.content_set.filter(attribute__name='Alt Page
Title')[0].text_content
Actually, I'm seeing this in other queries as well, whenever I have an
INNER JOIN it seems the WHERE arguments are assumed to be numeric (ie:
not quoted).
Thanks,
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---