Changes between Initial Version and Version 5 of Ticket #11459
- Timestamp:
- Jun 7, 2012, 7:08:59 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #11459
- Property Status new → reopened
- Property Cc added
- Property Component Uncategorized → Database layer (models, ORM)
- Property Easy pickings unset
- Property Severity → Normal
- Property Type → Bug
- Property UI/UX unset
- Property Version 1.0 → 1.3
-
Ticket #11459 – Description
initial v5 1 1 Here is the error message: 2 {{{ 2 3 (1054, "Unknown column 'beyondStore_artist.name' in 'where clause'") 4 }}} 3 5 4 6 This is the invalid sql that calling count() is generating that causes the above error message: 7 {{{ 5 8 SELECT 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 }}} 6 10 7 11 Here is the code that generates the QuerySet: 12 {{{ 8 13 songs = models.Song.objects.select_related('album__genre__genre__id', 'artist__name').extra(where = [where_clause]) 9 14 t = songs.count() # sql error is caused by this call to count() 15 }}} 10 16 11 17 I 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)).