I have a content type called wedstrijdverslag created using CCK.
This results in a content type internally called content_wedstrijdverslag.
when activating show taxonomy breadcrumb for this content type, you make a variable called taxonomy_context_breadcrumb_content_wedstrijdverslag.

This variable is too long to fit into the variable table

The first time it gets inserted without any problem as MySQL automatically truncates the value to:
'taxonomy_context_breadcrumb_content_wedstrijdver'
When you update the settings an error occurs as your code tries to do an insert again because for him, the variable does not exists (as it is truncated)
The insert error states duplicate entry as while inserting the long variable for the second time, it gets truncated again and MySql finds the previous truncated value and thus give this error

user warning: Duplicate entry 'taxonomy_context_breadcrumb_content_wedstrijdver' for key 1 query: INSERT INTO variable (name, value) VALUES ('taxonomy_context_breadcrumb_content_wedstrijdverslag', 's:1:\"1\";') in /drupal-4.7.4/includes/database.mysql.inc on line 121

Maybe this can be avoided by altering the code so that the variable names get shorter for example use tacbc_content_wedstrijdverslag instead of taxonomy_context_breadcrumb_content_wedstrijdverslag

CommentFileSizeAuthor
#3 taxonomy_context.patch.txt1.13 KBednique

Comments

nedjo’s picture

Good suggestion for a fix, I'd welcome a patch.

I suppose you could change the field definition of variable.name, setting it to e.g. varchar(100). You could also suggest a core patch increasing the length of this field,

nedjo’s picture

Note that a patch would need to include an _update function to convert existing variables to the new format. This would mean introducing a taxonomy_context.install file, as we don't have one yet.

ednique’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

here's the patch... pretty simple...

nancydru’s picture

Status: Needs review » Closed (won't fix)

In Drupal 5 and 6, a variable name can be up to 128 characters. Your name is nowhere close to that.

avpaderno’s picture

Status: Closed (won't fix) » Active

The report has been opened for 4.7.x-1.x-dev, not for the Drupal 5, or Drupal 6 branch.

avpaderno’s picture

Title: variable name is too long and causes SQL error... » Variable name is too long and causes SQL error

If then the Drupal 4.7 branch is not supported anymore, that is a different topic.

nancydru’s picture

Status: Active » Closed (fixed)

I don't see 4.7 as a supported release on the project page. Even if it was, I don't have access to a 4.7 site to work on it. However, a quick and easy fix would be to go to the "variable" table and change the "name" column to VARCHAR(128).