Unknown column error

BryanSD - July 4, 2009 - 05:12
Project:XML sitemap
Version:6.x-2.x-dev
Component:xmlsitemap.module
Category:bug report
Priority:minor
Assigned:Dave Reid
Status:closed
Description

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.

#1

KiamLaLuno - July 4, 2009 - 06:15

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?

#2

KiamLaLuno - July 4, 2009 - 06:25

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.

#3

BryanSD - July 4, 2009 - 17:26

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.

#4

Dave Reid - July 4, 2009 - 17:38
Assigned to:Anonymous» 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.

#5

Dave Reid - July 4, 2009 - 17:40

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

#6

BryanSD - July 4, 2009 - 20:36

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.

#7

KiamLaLuno - July 4, 2009 - 21:41

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

#8

BryanSD - July 7, 2009 - 18:05

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.

#9

Dave Reid - July 13, 2009 - 22:55
Status:active» postponed (maintainer needs more info)

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

#10

BryanSD - July 22, 2009 - 04:46
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.

#11

BryanSD - July 25, 2009 - 03:47
Status:postponed (maintainer needs more info)» closed

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.

#12

KiamLaLuno - July 25, 2009 - 14:01
Status:closed» 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.

#13

System Message - August 8, 2009 - 14:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.