Duplicate entry error

foxtrotcharlie - April 7, 2008 - 13:17
Project:RelatedContent
Version:5.x-1.6
Component:Code
Category:support request
Priority:normal
Assigned:TBarregren
Status:closed
Description

When I edit and save a specific cck content type which has the related content fieldset at the bottom, I firstly, get a watchdog lock tables error:

Duplicate entry &amp;#039;relatedcontent_exclude_teasers_intersection_news&amp;#039; for key 1\nquery: INSERT INTO variable (name, value) VALUES (&amp;#039;relatedcontent_exclude_teasers_intersection_newsletter&amp;#039;, &amp;#039;s:1:\\&amp;quot;1\\&amp;quot;;&amp;#039;)</em> in <em>/whatever/includes/database.mysql.inc</em> on line <em>172</em>.', 2,

And secondly, when I refresh the page, the following mysql error:
    * user warning: Duplicate entry 'relatedcontent_exclude_teasers_intersection_news' for key 1 query: INSERT INTO variable (name, value) VALUES ('relatedcontent_exclude_teasers_intersection_newsletter', 's:1:\"1\";') in /whatever/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'relatedcontent_output_placing_intersection_newsl' for key 1 query: INSERT INTO variable (name, value) VALUES ('relatedcontent_output_placing_intersection_newsletter', 's:3:\"end\";') in /whatever/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'relatedcontent_output_teasers_intersection_newsl' for key 1 query: INSERT INTO variable (name, value) VALUES ('relatedcontent_output_teasers_intersection_newsletter', 's:1:\"1\";') in /whatever/includes/database.mysql.inc on line 172.
    * user warning: Duplicate entry 'relatedcontent_output_grouped_intersection_newsl' for key 1 query: INSERT INTO variable (name, value) VALUES ('relatedcontent_output_grouped_intersection_newsletter', 's:4:\"type\";') in /whatever/includes/database.mysql.inc on line 172.

I have read the faq pages: http://drupal.org/node/17241 and http://drupal.org/node/69722 so have a general idea of what the errors mean, but I'm at a bit of a loss as to what to do to sort it out. Should I delete the relatedcontent variables (mentioned above) from the variable table?

Does this actually have anything to do with relatedcontent, or is it just something a bit screwed up with my drupal database?

Just checked on my local machine - I get a different error:

user warning: Data too long for column 'name' at row 1 query: INSERT INTO variable (name, value) VALUES ('relatedcontent_exclude_teasers_intersection_newsletter', 's:1:\"1\";') in C:\Apache2\htdocs\whatever\includes\database.mysql.inc on line 172.

This seems to imply that the variable table field 'name' is too short...so, should I just change the table field to be a longer varchar?

If I do change the length, how should I go about cleaning up the relatedcontent variables in the variable table - should I just delete them all?

Thanks :-)

#1

TBarregren - April 7, 2008 - 13:50
Category:bug report» support request
Assigned to:Anonymous» TBarregren

The simplest solution is probably to just shorten the name of your content type, e.g. from intersection_news to intersec_news, so the variable names don't become too long (i.e. more than 48 characters). You can also alter the variable table to allow longer variable names.

You don't have need to delete the already existing variables. But if you want to do that, you can do any of following alternatives:

  • Uninstall the module, upon which the variables are removed. NOTA BENE: If you uninstall the module, nodes will loose any related content because uninstall also drops the relatedcontent table.
  • Install the Devel module and delete just those variables you want.
  • Execute following SQL statement: DELETE FROM variable WHERE name LIKE 'relatedcontent_%'.

I will shorten the variable names in future version to minimize the risk for this kind of problem. See #243592: Shorten the variable names.

#2

foxtrotcharlie - April 7, 2008 - 14:15
Status:active» closed

Thank you so much for the quick and useful help :-)

 
 

Drupal is a registered trademark of Dries Buytaert.