Changes between Initial Version and Version 5 of Ticket #11459


Ignore:
Timestamp:
06/07/2012 07:08:59 AM (3 years ago)
Author:
aaugustin
Comment:

Fixed formatting (please use preview).

EDIT: sorry, I saw you reposted a properly formatted report afterwards!

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11459

    • Property Status changed from new to reopened
    • Property Severity changed from to Normal
    • Property Cc jamey j added
    • Property Patch needs improvement unset
    • Property Component changed from Uncategorized to Database layer (models, ORM)
    • Property Needs tests unset
    • Property Version changed from 1.0 to 1.3
    • Property Easy pickings unset
    • Property Type changed from to Bug
    • Property Needs documentation unset
    • Property UI/UX unset
  • Ticket #11459 – Description

    initial v5  
    11Here is the error message:
     2{{{
    23(1054, "Unknown column 'beyondStore_artist.name' in 'where clause'")
     4}}}
    35
    46This is the invalid sql that calling count() is generating that causes the above error message:
     7{{{
    58SELECT COUNT(*) FROM `sss_song` WHERE (match(sss_song.title) against('hits')) or (match(sss_artist.name, sss_artist.description) against('hits')) or (match(sss_album.title, sss_album.description) against('hits'))
     9}}}
    610
    711Here is the code that generates the QuerySet:
     12{{{
    813songs = models.Song.objects.select_related('album__genre__genre__id', 'artist__name').extra(where = [where_clause])
    914t = songs.count() # sql error is caused by this call to count()
     15}}}
    1016
    1117I know that the query to get the actual data works just fine. It is only the COUNT that is not working. The work around was to get the count manually (by writing an sql statement that gets the count, and executing the statement 'manually' using connection.cursor().execute(sql)).
Back to Top