I received the following SQL message when navigating to a view containing a list of the users flagged nodes. Please let me know if you need any further information, I will leave the database untouched for a while.
user warning: Unknown column 'flag_content_fav_bookmark.vbid' in 'field list' query: SELECT DISTINCT(node.nid), photos.nid AS photos_nid, users.name AS users_name, users.uid AS users_uid, flag_content_fav_bookmark.vbid AS flag_content_fav_bookmark_vbid, votingapi_cache_vote_percent_average.value AS votingapi_cache_vote_percent_average_value FROM node node LEFT JOIN flag_content flag_content_fav_bookmark ON node.nid = flag_content_fav_bookmark.content_id AND flag_content_fav_bookmark.fid = '2' INNER JOIN photos photos ON node.nid = photos.nid INNER JOIN users users ON node.uid = users.uid LEFT JOIN votingapi_cache votingapi_cache_vote_percent_average ON node.nid = votingapi_cache_vote_percent_average.content_id AND votingapi_cache_vote_percent_average.content_type = 'node' AND votingapi_cache_vote_percent_average.value_type = 'percent' AND votingapi_cache_vote_percent_average.tag = 'vote' AND votingapi_cache_vote_percent_average.function = 'average' WHERE (flag_content_fav_bookmark.uid IS NOT NULL) AND (flag_content_fav_bookmark.uid = 1) LIMIT 0, 10 in /var/www/drupal/includes/database.mysql.inc on line 172.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | output2.txt | 20.44 KB | CoolDreamZ |
| #17 | output.txt | 3.66 KB | CoolDreamZ |
| #13 | new _flag.png | 35.38 KB | CoolDreamZ |
| #13 | flags.html_.tar_.gz | 613 bytes | CoolDreamZ |
Comments
Comment #1
CoolDreamZ commentedComment #2
mooffie commentedViews tries to pull-in a "vbid" field. In "Views Bookmark 1.4" there's indeed a "vbid" field: it's the "Bookmark: Ops for Bookmarks" field. CoolDreamZ, do you parhaps remember if you had these "Ops" on your view? ("Ops" are the bookmark/unbookmark links).
This field was later renamed, in "Views Bookmark dev", to "ops".
So you should have first gotten rid of this "vbid" field by upgrading to "Views Bookmark dev", before migrating to Flag. Of course I don't blame you for not doing this ;-)
Hmmm....
Nate, I think there are three options here:
CoolDreamZ, could you try to apply these "general instructions for fixing problems" and report back? (But perhaps Nate would want to ask you some questions first. So it's better to wait a bit.)
or:
to:
(code not tested.)
I'm in favor of option #2, the "general instructions". But I also think we should release a "Views Bookmark 1.5".
Comment #3
mooffie commentedBut already you can execute half of these instruction: go to you view's edit page and see if you have 'empty' line(s) in the fields or filters or arguments sections. You should see only one such line: where your "Ops" field used to be. Let me know if that's what you see. Don't yet modify your view.
Comment #4
mooffie commentedI have two new ideas:
1. You should be able to export your view. Please do that, paste it to pastebin.com, and paste here the link.
2. You can clone your view and apply the "general instruction" to the clone.
Comment #5
CoolDreamZ commentedThanks for a quick response. Yes, that indeed seems to be the problem. Here is the exported view, I will try the fixes later (this is on my dev site not a live site).
Comment #6
CoolDreamZ commentedSorry, forgot to use pastebin.com !
Comment #7
CoolDreamZ commentedI removed the original field from the view and added the "Flag: Ops for fav bookmark" field instead. I now get a new SQL error:
Comment #8
CoolDreamZ commentedI also get the same (new) SQL error if I create the view from scratch (but without re-creating the bookmark/flag type)
Comment #9
mooffie commentedYes, so it was the Ops field. I'll probably open a separate issue.
(I'm investigating this.)
Comment #10
mooffie commentedCoolDreamZ,
The short answer: clearing Views' cache will probably solve this problem (there's a 'clear' button at ?q=admin/build/views/tools).
let us know if it doesn't solve your problem.
(I'm cusrious if you meant to say: "It only happens to existing flags. New flags work alright." I assume it's not what you meant to say.)
The long answer:
That's an interesting problem. Your first query in this issue has:
But your current one has:
The current one is missing the final " = '2'". On the one hand $flag->name is known ('fav_bookmark'), but on the other hand $flag->fid (2) isn't known. That's weird. That's what eventually leads to the 'flag_types_.type' problem as well. I can't think of an explanation for this, and for the meantime I'll assume this is something users of this module aren't likely to encounter. (If the 'clear' button doesn't solve your problem, I'll change my mind.)
Comment #11
mooffie commentedIt turns out most of what I wrote in comment #2 wasn't correct:
This module *does* know to migrate the Ops pseudo field from VB 1.4. It's just that there was a typo that prevented this migration from hapenning. I fixed this.
Comment #12
mooffie commentedSo the only problem left here is the "new SQL error" (comment #7). I'm marking this "needs more info": I need to know if the "clear cache" button solves it.
Comment #13
CoolDreamZ commented1. Clearing views cache did not solve the problem
2. Error #7 was when I edited the existing view and removed/replaced the flag ops
2. #8 was a new view using the existing flag. I had not tried creating a new flag.
I have now tried creating a new flag and get this SQL error, I also attach a screenshot and HTML dump (tarball) of the {flags} table
user warning: Column count doesn't match value count at row 1 query: INSERT INTO flags (fid, content_type, name, title, flag_short, flag_long, flag_message, unflag_short, unflag_long, unflag_message, roles, global, teaser, node_form) VALUES (3, 'node', 'newflag', 'New Flag', 'flag', 'flag this', 'flagged', 'unflag', 'unflag this', 'unflagged', '2', 0, 'a:3:{s:12:\"show_on_page\";i:1;s:14:\"show_on_teaser\";i:1;s:12:\"show_on_form\";i:0;}') in /var/www/drupal/includes/database.mysql.inc on line 172.Comment #14
mooffie commentedThis has been fixed already, here. Sorry for the bother. I've asked Nate about creating a 'dev' release to solve this problem.
===
So we're left with error #7.
1. It doesn't happen on new views?
2. Could you give me the output of the following command?
This will tell us exactly how Views sees this table.
(You seem like a 'power user', that's why I feel I can ask you to execute some code. The 'devel' module makes this simple. But it's ok if you can answer only my first question.)
Comment #15
CoolDreamZ commentedQ1 -yes, #7 happens on new views (see #8 above)
Q2 - happy to run the PHP code. (Thanks for the "power user" :-) I do have devel installed however, after hunting around, I can't see where to enter/execute the code. I am also running the Eclipse IDE and zend debugger.
Comment #16
mooffie commentedDevel has an 'Execute php' block you can enable and put, e.g., in your footer. Go to the the blocks administration page and enable this block there (I don't remember the block's name but it won't be hard to recognize it).
Comment #17
CoolDreamZ commentedThanks, found the block (was called "Execute PHP"). I have attached the output.
Comment #18
mooffie commentedThanks for the output.
That's what I suspected: the 'fid' slots are all empty. It's a mystery, because other properties of the flag, e.g. $flag->title (which is "Fav Bookmark"), do get seen.
Could you please give me the output of the following code?
Comment #19
CoolDreamZ commentedI have attached the output requested
Comment #20
mooffie commentedThanks. That new output shows that the problem isn't in Views but in the database.
I have a good guess: the table 'flag_types' doesn't contain the node-types this flag applies to.
Could you please give me the output of "SELECT * FROM flag_types" ? If my guess is correct, we won't see there records whose 'fid' column equals '2'.
Comment #21
CoolDreamZ commentedYou are correct. There are only three rows:
FID type
1 story
1 forum
3 photo
Comment #22
mooffie commentedOK, I think we've finished here.
The module could not load flags that weren't associated with some node-type. That caused your problem(s). I fixed that.
You'll now (after downloading the 'dev' version) be able to edit this 'Fav Bookmark' flag: the first thing you should do is to associate it with some node-type(s), because this module can't handle 'orphan' flags.
The next thing you should do is clear Views' cache (there's a 'clear' button at ?q=admin/build/views/tools).
This should fix all your problems. If it doesn't, re-open this issue.
Notes:
Thanks a lot for your feedback, you've helped to make the module better.
Comment #23
CoolDreamZ commentedAll working fine now, thanks :-)
I think the problem with the flag not being associated *may* be because I deleted one of the two node types originally associated with the flag before I migrated, the other node type was still defined.
Comment #24
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.