In Mysql version: 5.0.47 the query:
db_query("DELETE FROM {apachesolr_search_node} USING {apachesolr_search_node} asn INNER JOIN {node} n ON asn.nid = n.nid WHERE n.type = '%s'", $type);
Causes the error:
WD php: Unknown table 'apachesolr_search_node' in MULTI DELETE

The issue is that using the alias for apachesolr_search_node means that mysql can no longer recognise the table to delete. Rewriting the query without the aliases as:
db_query("DELETE FROM {apachesolr_search_node} USING {apachesolr_search_node} INNER JOIN {node} ON apachesolr_search_node.nid = node.nid WHERE node.type = '%s'", $type);

Fixes the problem. Patch supplied.

CommentFileSizeAuthor
apachesolr_rebuild_index_table_mysql.patch752 bytestheapi

Comments

jpmckinney’s picture

Status: Active » Closed (duplicate)

Marking duplicate of #592522: Hooks node_type, taxonomy and user knocks out our database server so that we can correct this bug in that issue.

jpmckinney’s picture

Note that we need to use table aliases in case someone configures Drupal with table prefixes, so the current patch won't work in all configurations.