[drupal-devel] [bug] Forum table: vid gone AWOL

syllance drupal-devel at drupal.org
Sat Sep 17 01:14:35 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    forum.module
 Category:     bug reports
 Priority:     critical
 Assigned to:  Souvent22
 Reported by:  robertDouglass
 Updated by:   syllance
 Status:       patch (code needs review)

I 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 :)


Previous comments:

Thu, 15 Sep 2005 21:02:54 +0000 : robertDouglass

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.


Fri, 16 Sep 2005 17:20:49 +0000 : syllance

There'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.


Fri, 16 Sep 2005 17:55:55 +0000 : Souvent22

Attachment: http://drupal.org/files/issues/ref_error_0.patch (4.64 KB)

Yes, 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

So in short, form.module has been updated to use revisions, however,
you're missing a vid field in your table.


Fri, 16 Sep 2005 17:58:04 +0000 : Souvent22

Update status; anyone wanna take a look?


Fri, 16 Sep 2005 18:01:31 +0000 : Souvent22

Attachment: http://drupal.org/files/issues/database_forum.patch (1.27 KB)

Crap, wrong patch. :). Too many things at once, sheesh. Get stable
already Drupal! :). Anyway, here's the right one....I aplogize, ignore
the other ones.


Fri, 16 Sep 2005 18:06:57 +0000 : Souvent22

Just 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.

More information about the drupal-devel mailing list