Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The function forum_load consists entirely of this query:
function forum_load($node) {
$forum = db_fetch_object(db_query('SELECT * FROM {forum} WHERE vid = %d', $node->vid));
return $forum;
}
The forum table, however, has no vid column. What should it be? WHERE nid = %d
?
I haven't been following the changes to forum.module closely, so I don't know the rest of the issues involved, but the module doesn't work as is.
Comment | File | Size | Author |
---|---|---|---|
#4 | database_forum.patch | 1.27 KB | Souvent22 |
#2 | ref_error_0.patch | 4.64 KB | Souvent22 |
Comments
Comment #1
syllance CreditAttribution: syllance commentedThere's also en error when simply adding forum topic :
user error: Unknown column 'vid' in 'field list'
query: INSERT INTO forum (nid, vid, tid) VALUES (6, 6, 2) in /drupal/head/database.mysql.inc on line 99.
Sounds like the removed vid field in forum table is still used in forum.module queries.
The forum topic node is inserted, but not linked with forum due to this error, so that's blocking the use of forums.
I've quickly searched but could not find any patch for this. I'll double check and try to make one if needed.
Comment #2
Souvent22 CreditAttribution: Souvent22 commentedYes, vid should be the second column, just as the query says, INSERT INTO....(nid, vid,tid)....
Seems you have the code for this, but you havne't updated your database with update.inc, i'm not sure if there is an update to the forum table in update.inc.....
Well, nevermind, a quick check shows that in updates.inc, it does alter your tables for you and fix the problem, however, the current schema in database.mysql and database.pgsql does *not*. Here's a patch that fixes that.
So in short, form.module has been updated to use revisions, however, you're missing a vid field in your table.
Comment #3
Souvent22 CreditAttribution: Souvent22 commentedUpdate status; anyone wanna take a look?
Comment #4
Souvent22 CreditAttribution: Souvent22 commentedCrap, wrong patch. :). Too many things at once, sheesh. Get stable already Drupal! :). Anyway, here's the right one....I aplogize, ignore the other ones.
Comment #5
Souvent22 CreditAttribution: Souvent22 commentedJust to clairfy, update_146() in updates.inc does correctly update the forum table and add the vid column. However, the databaswe creation scripts (database.mysql, database.pgsql) do NOT have the correct new schema for the forum table.
Comment #6
syllance CreditAttribution: syllance commentedI was surprised to find such an issue, even in head :) And i was right. I've been reading the node revisions changes, and just thought the database script were not updated yet. I simply did not thought to check the update script.
That will be in my check list now, as everything works fine after running the update.
Thanks for your quick answer, and thanks again to everyone making drupal such a nice thing :)
Comment #7
robertDouglass CreditAttribution: robertDouglass commentedIf all that is missing is the vid column from the database creation scripts, this patch should be a no brainer. Here is the pertinent SQL patch for those on the list that don't want to look for the patch:
It looks good to me.
Comment #8
syllance CreditAttribution: syllance commentedi've quickly checked on my test sandbox, and there's a "duplicate" entry error when creating a forum topic revision.
the update is to add the vid field, create a primary key on it, and make nid a non-primary key.
i'll try to provide updated patches later today, but mysql changes should something like :
CREATE TABLE forum (
nid int(10) unsigned NOT NULL default '0',
+ vid int(10) unsigned NOT NULL default '0',
tid int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (nid),
+ KEY (nid),
+ PRIMARY KEY vid (vid),
KEY tid (tid)
) TYPE=MyISAM;
(manual patch :p, i'll do the thing later)
while talking database, do you know if there's any specific reason why all drupal tables are forced MyISAM type ?
Comment #9
m3avrck CreditAttribution: m3avrck commentedCode looks good to me.
Comment #10
Dries CreditAttribution: Dries commentedThere is no patch?
Comment #11
robertDouglass CreditAttribution: robertDouglass commentedyes there is:
http://drupal.org/files/issues/ref_error_0.patch
Comment #12
robertDouglass CreditAttribution: robertDouglass commentedOops:
http://drupal.org/files/issues/database_forum.patch
Comment #13
m3avrck CreditAttribution: m3avrck commentedYes patch is in comment #4 and as I said above, code looks correct to me.
Comment #14
Cvbge CreditAttribution: Cvbge commentedLooks good for me too.
Comment #15
Dries CreditAttribution: Dries commentedCommitted to HEAD. Thanks.
Comment #16
(not verified) CreditAttribution: commented