I recieved these two errors when I attempt to visit the page view
user warning: Unknown table 'file_revisions' in where clause query: SELECT count(node.nid) FROM node node WHERE (file_revisions.fid) in /home/denied/public_html/site/includes/database.mysql.inc on line 167.
user warning: Unknown table 'file_revisions' in where clause query: SELECT node.nid, node.title AS node_title, node.changed AS node_changed, node.vid FROM node node WHERE (file_revisions.fid) ORDER BY node.title ASC LIMIT 0, 10 in /home/denied/public_html/site/includes/database.mysql.inc on line 167.
I am attempting a page view with a table listing node titles and attached files
I have 2 fields which are Node: Title and Files: All Files
I have 1 filter which is File: Has file downloads
I am using version 5.x-1.4-2rc1
Comments
Comment #1
rjl CreditAttribution: rjl commentedSome additional information:
I changed the field
File: All Files
to
File: Name
and there is no longer an error and it provides me with what I need.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedIf you do not have a file_revisions table in Drupal 5, then something is wrong with your system. That table should exist.
Comment #3
rjl CreditAttribution: rjl commentedI do have a file_revisions table. The problem is with the SQL syntax. The file_revisions table is not listed in the FROM clause.
ERROR 1:
This query doesn't work, and produces the error
SELECT count(node.nid)
FROM node node
WHERE (file_revisions.fid)
But with the addition of the file_revisions table in the FROM clause it works
SELECT count(node.nid)
FROM node node LEFT JOIN file_revisions ON node.vid = file_revisions.vid
WHERE (file_revisions.fid)
ERROR 2:
This query doesn't work, and produces the error
SELECT node.nid, node.title AS node_title, node.changed AS node_changed, node.vid
FROM node node
WHERE (file_revisions.fid)
But with the addition of the file_revisions table in the FROM clause it works
SELECT node.nid, node.title AS node_title, node.changed AS node_changed, node.vid
FROM node node LEFT JOIN file_revisions ON node.vid = file_revisions.vid
WHERE (file_revisions.fid)
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedIn the file: views/modules/views_upload.inc
In the function: function views_handler_file_filter_fid_exist($op, $filter, $filterdata, &$query) {
Please add this line: $query->ensure_table('file_revisions');
Right after: case 'handler':
And tell me if that fixes the problem for you?
Comment #5
rjl CreditAttribution: rjl commentedThat worked great!
Thanks
BTW - This module is amazing, thank you!
Comment #6
David Lesieur CreditAttribution: David Lesieur commentedIn my case, adding ensure_table() doesn't fix the problem. Here's my test View:
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedThe query may have been cached; try going to the view and clicking 'save'.
Comment #8
David Lesieur CreditAttribution: David Lesieur commentedYes, that did it. :-) I had thought that devel.module's "empty cache" would have cleared that.
Thanks!
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedViews cache their queries independently, and unfortunately there's no mechanism to just deal with it. I need to retool how that caching works. It's a problem that shows up...well, like this. I'm glad this fixes the problem though.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedPatch committed. This will be released in the Views 1.5.
Comment #11
David Lesieur CreditAttribution: David Lesieur commentedGreat! I'll apply the same fix to a new filter I did today for image_attach.
Comment #12
(not verified) CreditAttribution: commented