Getting the following error at cron runs...

Unknown column 'menu_name' in 'field list' query: INSERT INTO xmlsitemap (id, type, loc, access, status, lastmod, priority, priority_override, changefreq, changecount, menu_name) VALUES (202, 'menu', 'node/821', 0, 1, 0, NULL, NULL, 0, 0, 'primary-links') in .../sites/all/modules/xmlsitemap/xmlsitemap.module on line 805.

Comments

avpaderno’s picture

Maybe it doesn't matter, but I noticed that the implementation of hook_schema_alter() that would add the menu_name field is defined in the installation file. Is that normal, or should the hook be defined in the module file?

avpaderno’s picture

Where hook_schema_alter() is located doesn't make a difference. Before the call to drupal_alter('schema', $schema), Drupal calls module_load_all_includes('install'); even if the hook would be in the installation file, the file would be already loaded from Drupal, by the time it executes the call to drupal_alter('schema', $schema).

It seems that when the query is executed, the schema has not been altered from xmlsitemap_menu.module; maybe it happens because Drupal core code is using the schema it saved in its cache.

bryansd’s picture

You may be onto something. When I cleared the menu cache, many of the errors went away. Also some signs that this may not be just an XML sitemap issue. I was doing some menu changes just prior to the errors. Also, I was also seeing some issues with a couple other modules before clearing the menu cache.

dave reid’s picture

Assigned: Unassigned » dave reid

xmlsitemap_menu uses schema_alter and also adds the column in an update/install function. Since schemas are cached, my guess is this was a problem that drupal_write_record() was using the cached schema before the change. I can look into clearing the schema cache when these columns are added and that should prevent this error from popping up.

dave reid’s picture

Hmm...but running update.php should clear the caches (which include the schema cache), so I'm not sure that would do any good.

bryansd’s picture

My issue seemed to develop after running the update.php and after making changes with the menu. It seems when I manually clear the menu cache the reported issues with XML sitemap clears.

avpaderno’s picture

Did you enable third-party modules that handle the menu?

bryansd’s picture

KimLaLuno, about the only contributed module that I'm running dealing with menus is pathauto. I'm also seeing a number of duplicate entry errors regarding the menu tables. So this issue may actually be reported to those in:

http://drupal.org/node/246653
http://drupal.org/node/333428

What's confusing me though is these errors only seem present when I have the XML sitemap module loaded.

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

BryanSD, have you had this problem happen since your last post?

bryansd’s picture

Priority: Normal » Minor

I haven't seen the unknown column error the past couple weeks. Let's keep it postponed for a few more days. If I don't see the return of this error I'm ok with closing this issue.

bryansd’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Since I haven't seen the Unknown column 'menu_name' error for some time and no one else is reporting it...I'm closing it.

avpaderno’s picture

Status: Closed (fixed) » Fixed

It's usual to set the report to fixed, so other can see the report for the next 2 weeks (and avoid open a similar one).

I am not sure if to classify this as a bug report, as the error went away alone.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.