Using Views 5.x-1.5 with Drupal 5.1:
When adding a new Calendar view, I get an error when trying to add in http://mysite/?q=admin/build/views/edit/1 a filter of the following type:
"Book: parent node"
The error is:
user warning: Unknown column 'book.vid' in 'on clause' query: SELECT DISTINCT parent FROM prefix_book INNER JOIN prefix_node n ON book.vid = n.vid ORDER BY parent in /var/htdocs/drupal50/includes/database.mysqli.inc on line 151.
All my database tables start with 'prefix_'
It looks like the error is on line 131 of modules/views_book.inc , which reads:
$result = db_query("SELECT DISTINCT parent FROM {book} INNER JOIN {node} n ON book.vid = n.vid ORDER BY parent");
[ON book.vid =] should probably read [ON {book}.vid =] to accept table prefixing. Making this change solves the problem for me.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | views-filter-book-parent_0.patch | 682 bytes | Anonymous (not verified) |
| #1 | views-filter-book-parent.patch | 685 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) commentedIf it is easier to fix this problem by providing a patch - here it is ;-)
Comment #2
yched commentedI think the usual syntax is rather to add an alias to the table :
SELECT DISTINCT parent FROM {book} b INNER JOIN {node} n ON b.vid = n.vidComment #3
neclimdulyched is correct, this should be aliased.
Comment #4
Anonymous (not verified) commentedThanks for the hint/remark ... I updated the patch (it's my first one ;-))
Comment #5
merlinofchaos commentedCommitted. Thanks for the patch!
Comment #6
(not verified) commented