Project:RelatedContent
Version:5.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:TBarregren
Status:closed (fixed)

Issue Summary

When upgrading from version 1.0, I got the following error:

user warning: You have an error in your SQL syntax near 'AS a INNER JOIN (SELECT include_nid FROM relatedcontent) AS b ON a.include_nid =' at line 1 query: UPDATE relatedcontent AS a INNER JOIN (SELECT include_nid FROM relatedcontent) AS b ON a.include_nid = b.include_nid SET a.ordinal_number = b.include_nid; in /usr/www/cpt/www/includes/database.mysql.inc on line 172.

Which appears to be generated from line 82 of relatedcontent.install:

UPDATE {relatedcontent} AS a INNER JOIN (SELECT include_nid FROM {relatedcontent}) AS b ON a.include_nid = b.include_nid SET a.ordinal_number = b.include_nid;

When I went to an existing node with Related Content and clicked on the Related Content tab, I got the following error:

user warning: You have an error in your SQL syntax near 'IN ('')) ' at line 1 query: SELECT count(node.nid) FROM node node WHERE (. IN ('')) in /usr/www/cpt/www/includes/database.mysql.inc on line 172.

Do I need to reinstall 1.5 from scratch or is there a way to fix this?

P.S. Thanks very much for tying the order of related content to the view in 1.5

Comments

#1

Title:Error when updating» MySQL 4.0 error when updating
Assigned to:Anonymous» TBarregren

I can confirm the first error message when using MySQL 4.0. The query works fine on MySQL 4.1 (not verified) and MySQL 5.x (verified). What version of MySQL are you running?

I cannot repeat the second error. The WHERE clause of the query in the error message is obviously faulty. It should read ...WHERE (node.type IN ('story')) where 'story' is the content type at hand. Since it is the Views module that is responsible for building that particular query, I wonder which version of Views you are running. Or more interesting, if you update the Views module to the latest version, does the error remain?

Do I need to reinstall 1.5 from scratch or is there a way to fix this?

The query in the first error message copies the values from the include_nid column of the relatedcontent table to the newly added column ordinal_number. The purpose is to preserve the order of related content created in the 5.x-1.0 -- 5.x-1.4 versions of RelatedContent. If that is not important, there is nothing to worry about.

If it is important to keep the order, take a backup of your database, save the included file in the home directory of Drupal; copy line 93 in your settings.php to line 4 in this file; and point your web browser to the file: http://www.example.com/relatedcontent_mysql40_fix.php.

The query in the second error message is used to calculate how many pages are needed for the table of nodes to select from. It doesn't affect your database at all.

AttachmentSize
relatedcontent_mysql40_fix.php_.txt 1.9 KB

#2

Status:active» fixed

This is fixed in 1.6.

#3

Status:fixed» closed (fixed)

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

nobody click here