Am trying to get upgraded, getting stuck here...

The following updates returned messages

taxonomy module

Update #7005
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-2-2-0-0-und' for key 1: INSERT INTO {field_revision_taxonomyextra} (entity_type, entity_id, revision_id, bundle, language, delta, taxonomyextra_tid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => 2 [:db_insert_placeholder_3] => weblinks [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 72 ) in taxonomy_update_7005() (line 695 of /home/hoslot5/public_html/modules/taxonomy/taxonomy.install).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Starminder’s picture

Priority: Normal » Critical
Starminder’s picture

Category: support » bug
catch’s picture

Looks like the update is attempting to insert the same delta twice.

Could you run SELECT * FROM term_node WHERE nid = 2; and paste the results in here?

Starminder’s picture

Did you really mean SELECT * FROM `taxonomy_term_node` WHERE nid = 2?

SQL result

===Database hoslot5_hosr

== Table structure for table taxonomy_term_node

|------
|Field|Type|Null|Default
|------
|nid|int(10) |No|0
|//**vid**//|int(10) |No|0
|//**tid**//|int(10) |No|0
== Dumping data for table taxonomy_term_node

|2|2|112
|2|2|1645
|2|2|72
|2|2|150
|2|2|1644
|2|2|246
|2|2|149
|2|2|108
|2|2|969
|2|2|1643
|2|2|1642
|2|2|156
== Table structure for table taxonomy_term_node

|------
|Field|Type|Null|Default
|------
|nid|int(10) |No|0
|//**vid**//|int(10) |No|0
|//**tid**//|int(10) |No|0

If I did it wrong just holler :) Thanks Catch!

catch’s picture

That looks normal to me. Are you trying to re-run an update?

If you are, then that's not supported - if you get an error updating, you need to restore a backup of your Drupal 6 site, then run the upgrade from scratch again. You can then work through the errors one at a time, and eventually it should complete successfully.

Starminder’s picture

ack. funny thing happened, thought I had a good backup of the db but it appears I do not. any other suggestions?? :)

moshe weitzman’s picture

Priority: Critical » Normal
Starminder’s picture

So...do I have ANY options here?

catch’s picture

Category: bug » support

Truncate the field data table for that field before rerunning the update may get you through it, but you don't have many options if you haven't kept a backup.

Starminder’s picture

Truncate worked! YAY! I still have a ton of issues related to the upgrade, but I think this was the largest.

Starminder’s picture

Status: Active » Closed (fixed)
surfer_1’s picture

I am getting same error when upgrade from d6 to d7. What is truncate? anyone help me please. How can apply it?

Jean Gionet’s picture

I'm still getting this error while trying to upgrade from 6.22 to 7.4

taxonomy module

Update #7005
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-65-65-0-0-und' for key 'PRIMARY': INSERT INTO {field_revision_taxonomy_vocabulary_6} (entity_type, entity_id, revision_id, bundle, language, delta, taxonomy_vocabulary_6_tid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 65 [:db_insert_placeholder_2] => 65 [:db_insert_placeholder_3] => group_post [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 262 ) in taxonomy_update_7005() (line 700 of S:\apache\webs\intra2\htdocs\modules\taxonomy\taxonomy.install).

any fixes or workarounds? I've tried emptying the tables it mentions and still no go!

lionel.a’s picture

Title: Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-2-2-0-0-und' for key 1 » taxonomy module Update #7005 Failed: PDOException: SQLSTATE[23000]
Category: support » bug

Hi,
The solution at #9 worked also for me :
TRUNCATE TABLE `taxonomy_term_node`;

I tried at first to delete only the line with problem (in my case, it wasn't 2 but 20). After that, the problem moved to 24. So, the truncate option was better.

Thanks !

Aurochs’s picture

Thanx - but am i losing some data or terms after truncate? it actually helped me and i had no mor emistakes after that. but still migrating so what can be the results of such action?

darrick’s picture

Category: bug » support

@Aurochs You'll want to TRUNCATE field_data_taxonomyextra, field_revision_taxonomyextra and all the field_data_taxonomy_vocabulary_x and field_revision_taxonomy_vocabulary_X tables. Not the the taxonomy_term_node table which is your source data.

I ran into the problem because I had a nodes with negative created dates which caused inserts to taxonomy_index to fail. Which is another table you should TRUNCATE.

steveOR’s picture

Had this come up today on a local environment 6.22 -> 7.10 upgrade. Looks like the 7005 update is a bit slow if you have lots of taxonomy vocabs/terms, so this error in my case was caused by re-running update.php after a php script timeout on the previous try. Here was my solution:

php.ini - change max_execution_time to 300 (was set at 60 seconds)
restarted apache
truncated these tables only:
field_data_taxonomyextra
field_data_taxonomy_vocabulary_x (one table per vocabulary id)
field_revision_taxonomyextra
field_revision_taxonomy_vocabulary_x (one table per vocabulary id)
ran update.php

VaVoom! The 7005 update completes successfully and the other update scripts can continue. If at any point you get another script timeout, you need to truncate again before retrying.

Now onto more D7 upgrade tasks...
:)

fixus971’s picture

Version: 7.x-dev » 7.10
Status: Closed (fixed) » Active

Hi, I'm tried many time and in many mode using #17 without success:

TRUNCATE `field_data_taxonomyextra`;
TRUNCATE `field_data_taxonomy_vocabulary_1`;
TRUNCATE `field_data_taxonomy_vocabulary_2`;
TRUNCATE `field_data_taxonomy_vocabulary_4`;
TRUNCATE `field_data_taxonomy_vocabulary_5`;
TRUNCATE `field_data_taxonomy_vocabulary_6`;
TRUNCATE `field_data_taxonomy_vocabulary_7`;
TRUNCATE `field_data_taxonomy_vocabulary_8`;
TRUNCATE `field_data_taxonomy_vocabulary_9`;
TRUNCATE `field_revision_taxonomyextra`;
TRUNCATE `field_revision_taxonomy_vocabulary_1`;
TRUNCATE `field_revision_taxonomy_vocabulary_2`;
TRUNCATE `field_revision_taxonomy_vocabulary_4`;
TRUNCATE `field_revision_taxonomy_vocabulary_5`;
TRUNCATE `field_revision_taxonomy_vocabulary_6`;
TRUNCATE `field_revision_taxonomy_vocabulary_7`;
TRUNCATE `field_revision_taxonomy_vocabulary_8`;
TRUNCATE `field_revision_taxonomy_vocabulary_9`;

From Drupal 6.22 to Drupal 7.10 without modules/themes; PHP time limit set to 600; update in 1min.20sec

taxonomy module
Update #7005
Failed: PDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'created' at row 1: INSERT INTO {taxonomy_index} (nid, tid, sticky, created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 212 [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => -1 ) in taxonomy_update_7005() (line 696 of /home/fixus/www/fixweb/modules/taxonomy/taxonomy.install).

If retry for last 7 update tasks:

The following updates returned messages
taxonomy module
Update #7005
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-2-2-0-0-und' for key 'PRIMARY': INSERT INTO {field_revision_taxonomyextra} (entity_type, entity_id, revision_id, bundle, language, delta, taxonomyextra_tid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 2 [:db_insert_placeholder_2] => 2 [:db_insert_placeholder_3] => blog [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 13 ) in taxonomy_update_7005() (line 686 of /home/fixus/www/fixweb/modules/taxonomy/taxonomy.install).

Some time get red error:

Notice: Undefined index: update_success in update_results_page() (line 165 of /home/fixus/www/fixweb/update.php).
Warning: reset() expects parameter 1 to be array, null given in update_results_page() (line 169 of /home/fixus/www/fixweb/update.php).
Warning: array_pop() expects parameter 1 to be array, null given in update_results_page() (line 169 of /home/fixus/www/fixweb/update.php).
The update process was aborted prematurely while running update # in .module. All errors have been logged.

fixus971’s picture

Version: 7.10 » 7.x-dev

Same problem using Drupal-DEV

Notice: Undefined index: update_success in update_results_page() (line 165 of /home/fixus/www/fixweb/update.php).
Warning: reset() expects parameter 1 to be array, null given in update_results_page() (line 169 of /home/fixus/www/fixweb/update.php).
Warning: array_pop() expects parameter 1 to be array, null given in update_results_page() (line 169 of /home/fixus/www/fixweb/update.php).

The update process was aborted prematurely while running update # in .module. All errors have been logged.

Reminder: don't forget to set the $update_free_access value in your settings.php file back to FALSE.

fixus971’s picture

SOLVED!!
After reading: http://drupal.org/node/1301582
I realize mean of error text so as #16
I ran into the problem because I had a nodes with negative created dates which cause error on inserts.
To solve problem simply go in DB on Node table ordered by date.
Copy a normal value to negative dates elements.
Update.php->All done ok! ^_^ finally

xjm’s picture

Status: Active » Closed (fixed)

Interesting! I wonder what was setting negative created dates. Glad you got it working.

iamEAP’s picture

Status: Closed (fixed) » Active

I'm actually experiencing the same thing.

#17 does not work for me. Setting my max_execution_time absurdly high, though successful in making the updates run in a single go, does not make taxonomy_update_7005 succeed. Truncating all of the relevant tables and then running the update again also does not work.

#20 was not relevant to me as I have no nodes with negative create dates.

I also looked at the relevant values mentioned by catch in #3 and found nothing unusual (i.e. no duplicate values for the offending insert).

Any other ideas?

xjm’s picture

  • What PDO exception are you getting when you run the update?
  • What contributed modules related to taxonomy do you have installed?
  • Does uninstalling any of these modules allow you to run the update successfully? (Back up your data first.)
  • Can you try creating a small test site with your modules and seeing if you can reproduce the problem?

Also, it's generally probably better to file a new issue rather than reopening an old one; this one seems to be a collection of various different errors.

iamEAP’s picture

  1. The PDO exception is the same as the OP: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry... Bundle type node.
  2. This site has: tac_lite, taxonomy manager, taxonomy super select, profile taxonomy, draggableviews_taxonomy, content_taxonomy, content_taxonomy_options, and i18n_taxonomy.
  3. Obviously that's a big list of related modules, but I'll give this a shot when I have a chance. Any tips on which might be the more obvious offenders would be great.
  4. I can give this a shot too. Should I run devel generate as well, or would you prefer I only enable those modules?

Thanks for the quick response!

xjm’s picture

Hmm, lots of potential issues there. My first guess would be content taxonomy. Second would be i18n. As for trying to reproduce it, having devel generate enabled to generate the content should be fine. Thanks!

iamEAP’s picture

Status: Active » Closed (fixed)

Created a new issue on what may be a bug, with patch: #1526436: taxonomy_update_7005() sometimes fails when inserting into field_data_taxonomy_vocabulary_N Going to re-close this now.

Thanks again, xjm.

stoickthevast’s picture

I have problem here as well.

Update #7005
Failed: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-457-457-0-0-und' for key 'PRIMARY': INSERT INTO {field_revision_taxonomy_vocabulary_10} (entity_type, entity_id, revision_id, bundle, language, delta, taxonomy_vocabulary_10_tid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 457 [:db_insert_placeholder_2] => 457 [:db_insert_placeholder_3] => article [:db_insert_placeholder_4] => und [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 149 ) in taxonomy_update_7005() (line 686 of /var/www/vhosts/drupal/modules/taxonomy/taxonomy.install).

Thanks

rajeevk’s picture

Version: 7.x-dev » 7.9
Status: Closed (fixed) » Active

Hello, I am getting this error while migrating -

taxonomy module
Update #7005

    Failed: DatabaseSchemaObjectExistsException: Table <em class="placeholder">taxonomy_update_7005</em> already exists. in DatabaseSchema->createTable() (line 657 of C:\LocalServer\xampp\htdocs\connect\includes\database\schema.inc).

Can any body help ?

Thanks,
RajeevK

neozerosv’s picture

Drop the table taxonomy_update_7005 and restart the update. After that see if theres an error.

Anyway, you should start the update from zero, i mean woth the D6 database.

dddave’s picture

Status: Active » Closed (fixed)

Closing again

DuttonMa’s picture

Re-opening this as I had the same problem and using some of the truncate solutions above causes me to lose important taxonomy data during the upgrade.

I have added a try / catch around the offending insert queries and have specifically caught the integrity constraint exception (PDOEXCEPTION). This means that the appropriate table is only truncated when absolutely necessary and therefore no data is lost.

This solved my upgrade problem (which I had been stuck on for 3 days !).

geekinpink’s picture

#9 and #29 both worked for me
First i dropped table taxonomy_update_7005 table and then truncated table `taxonomy_term_node`;
Thnaks a lot:)

newswatch’s picture

Yes, #32 worked for me too :)

Smooth!

steinmb’s picture

Version: 7.9 » 10.0.x-dev

For whats it's worth. Debugging Drupal 7 date module in PostgreSQL and got this upgrading from Drupal 6 to 7.

How to reproduce:
* Install Drupal 6 LTS - default profile.
* Run upgrade to Drupal 7
* Remove all terms and vocabulary does not help.

Removing default 'story' content type and uninstall taxonomy module before upgrading to 7 does not help. Have not checked if the Taxonomy module in Drupal 6 really clean up, aka. remove its tables, when I uninstall. If not it could explain why 7005 trigger...

Update #7005

    Failed: PDOException: SQLSTATE[55000]: Object not in prerequisite state: 7 ERROR: currval of sequence "taxonomy_update_7005_n_seq" is not yet defined in this session: INSERT INTO taxonomy_update_7005 (vocab_id, tid, nid, vid, type, created, sticky, status, is_current) SELECT td.vid AS vocab_id, td.tid AS tid, tn.nid AS nid, tn.vid AS vid, n.type AS type, n2.created AS created, n2.sticky AS sticky, n2.status AS status, n2.nid AS is_current FROM taxonomy_term_data td INNER JOIN taxonomy_term_node tn ON td.tid = tn.tid INNER JOIN node n ON tn.nid = n.nid LEFT OUTER JOIN node n2 ON tn.vid = n2.vid ORDER BY tn.vid ASC, td.weight ASC, tn.tid ASC; Array ( ) in taxonomy_update_7005() (line 701 of modules/taxonomy/taxonomy.install).
steinmb’s picture

BTW: Patch in #31 does not address it, nor does workaround in #29

steinmb’s picture