Trying to update from 6.x-2.3 to 6.x-2.4 and the database update fails with a bunch of index errors.

Here is a fascinating but disillusioning excerpt:

Unknown column 'weight' in 'field list' query: SELECT url, weight, last_status, last_checked, click_count, last_click FROM weblinks WHERE nid = 5395 AND vid=5395 in /usr/local/apache2/vhosts/kpbj.com/htdocs/sites/all/modules/weblinks/weblinks.module on line 359

Unknown column 'bw.weight' in 'field list' query: SELECT DISTINCT(n.nid), bw.weight, n.title FROM node n INNER JOIN node_revisions nr ON nr.vid = n.vid INNER JOIN weblinks bw ON bw.vid = nr.vid LEFT JOIN term_node tn ON tn.nid=n.nid AND tn.vid=n.vid WHERE n.status = 1 AND tn.tid IN (432) ORDER BY bw.weight ASC, n.title ASC in /usr/local/apache2/vhosts/kpbj.com/htdocs/sites/all/modules/weblinks/weblinks.module on line 1150.

http://kpbj.com/update.php?id=3&op=do|http://kpbj.com/update.php?op=start&id=3|1||Duplicate column name 'urlhash' query: ALTER TABLE weblinks ADD `urlhash` CHAR(32) NOT NULL DEFAULT '' in /usr/local/apache2/vhosts/kpbj.com/htdocs/includes/database.mysql-common.inc on line 306.

Dec  6 23:32:34 piperhosting drupal: http://kpbj.com|1323243154|php|69.11.11.111|http://kpbj.com/update.php?id=3&op=do|http://kpbj.com/update.php?op=start&id=3|1||Duplicate key name 'urlhash' query: ALTER TABLE weblinks ADD INDEX urlhash (urlhash) in /usr/local/apache2/vhosts/kpbj.com/htdocs/includes/database.mysql-common.inc on line 442.

Dec  6 23:32:34 piperhosting drupal: http://kpbj.com|1323243154|php|69.11.11.111|http://kpbj.com/update.php?id=3&op=do|http://kpbj.com/update.php?op=start&id=3|1||Duplicate key name 'last_checked' query: ALTER TABLE weblinks ADD INDEX last_checked (last_checked) in /usr/local/apache2/vhosts/kpbj.com/htdocs/includes/database.mysql-common.inc on line 442.

Dec  6 23:32:34 piperhosting drupal: http://kpbj.com|1323243154|php|69.11.11.111|http://kpbj.com/update.php?id=3&op=do|http://kpbj.com/update.php?op=start&id=3|1||Can't DROP 'weight'; check that column/key exists query: ALTER TABLE weblinks DROP weight in /usr/local/apache2/vhosts/kpbj.com/htdocs/includes/database.mysql-common.inc on line 330.

The resulting update has a link page with categories but no links. Reverting back works to fix it. Hope someone else has a screenshot to help ya but I don't have time to reproduce it again for ya right this minute.

Drupal 6.22, MySQL 5.5.15, PHP 5.2.17, Apache 2.2.20

Comments

miguel_angel’s picture

StatusFileSize
new46.82 KB
new106.89 KB
new123.08 KB

Same issue here.

Screenshots attached.

Drupal 6.22, MySQL 5.0.91, PHP 5.2.16, Apache 2.2.17

ronline’s picture

The same here

GStegemann’s picture

And here as well.

bigcrunch’s picture

The same bug.

evelien’s picture

+1 subscribe

BasH’s picture

+1 subscribe, and of course this kind of warnings after continuing...:
user warning: Unknown column 'weight' in 'field list' query: SELECT url, weight, last_status, last_checked, click_count, last_click FROM weblinks WHERE nid = 46 AND vid=46 in weblinks.module on line 359.

mlammerts’s picture

+1 subscribe

witali’s picture

Same error and after that the URLs are not shown any more,... Previous settings seem to get erased.

---------------------
weblinks module
Update #6100
ALTER TABLE {weblinks} CHANGE `url` `url` TEXT NOT NULL DEFAULT ''
ALTER TABLE {weblinks} ADD INDEX url (url (2048))
Update #6101
No queries
Update #6102
Failed: ALTER TABLE {weblinks} ADD `last_status` CHAR(4) DEFAULT '200'
Failed: ALTER TABLE {weblinks} ADD `last_checked` INT unsigned DEFAULT 0
Update #6103
No queries
Update #6104
No queries
Update #6105
Failed: ALTER TABLE {weblinks} DROP INDEX nid
ALTER TABLE {weblinks} DROP PRIMARY KEY
ALTER TABLE {weblinks} ADD PRIMARY KEY (nid, vid)
Failed: ALTER TABLE {weblinks} DROP INDEX tid
Failed: ALTER TABLE {weblinks} ADD INDEX (tid)
Update #6106
Failed: ALTER TABLE {weblinks} DROP tid
Failed: ALTER TABLE {weblinks} ADD `click_count` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {weblinks} ADD `last_click` INT unsigned DEFAULT 0
Update #6107
variable_set('weblinks_visit_text', Weiter zu [title-raw] [title])
Update #6108
UPDATE {system} SET weight=-2 WHERE type='module' AND name='weblinks'
Update #6109
UPDATE {blocks} SET module='weblinks_blocks' WHERE module='weblinks'
---------------------
Drupal database update
user warning: Duplicate column name 'last_status' query: ALTER TABLE main_weblinks ADD `last_status` CHAR(4) DEFAULT '200' in .../includes/database.mysql-common.inc on line 306.
user warning: Duplicate column name 'last_checked' query: ALTER TABLE main_weblinks ADD `last_checked` INT unsigned DEFAULT 0 in .../includes/database.mysql-common.inc on line 306.
user warning: Can't DROP 'nid'; check that column/key exists query: ALTER TABLE main_weblinks DROP INDEX nid in .../includes/database.mysql-common.inc on line 456.
user warning: Can't DROP 'tid'; check that column/key exists query: ALTER TABLE main_weblinks DROP INDEX tid in .../includes/database.mysql-common.inc on line 456.
user warning: Key column 'tid' doesn't exist in table query: ALTER TABLE main_weblinks ADD INDEX (tid) in .../includes/database.mysql-common.inc on line 442.
user warning: Can't DROP 'tid'; check that column/key exists query: ALTER TABLE main_weblinks DROP tid in .../includes/database.mysql-common.inc on line 330.
user warning: Duplicate column name 'click_count' query: ALTER TABLE main_weblinks ADD `click_count` INT unsigned NOT NULL DEFAULT 0 in .../includes/database.mysql-common.inc on line 306.
user warning: Duplicate column name 'last_click' query: ALTER TABLE main_weblinks ADD `last_click` INT unsigned DEFAULT 0 in .../includes/database.mysql-common.inc on line 306.
---------------------
mdlueck’s picture

Subscribe... gggrrr.... rolling back the DB and mod I guess... yee haa at 21:30 and counting...

ajgarlag’s picture

+1

My log

The following queries were executed
weblinks module
Update #6100
ALTER TABLE {weblinks} CHANGE `url` `url` TEXT NOT NULL DEFAULT ''
ALTER TABLE {weblinks} ADD INDEX url (url (2048))

Update #6101
No queries
Update #6102
Failed: ALTER TABLE {weblinks} ADD `last_status` CHAR(4) DEFAULT '200'
Failed: ALTER TABLE {weblinks} ADD `last_checked` INT unsigned DEFAULT 0

Update #6103
No queries

Update #6104
No queries

Update #6105
Failed: ALTER TABLE {weblinks} DROP INDEX nid
ALTER TABLE {weblinks} DROP PRIMARY KEY
ALTER TABLE {weblinks} ADD PRIMARY KEY (nid, vid)
Failed: ALTER TABLE {weblinks} DROP INDEX tid
Failed: ALTER TABLE {weblinks} ADD INDEX (tid)

Update #6106
Failed: ALTER TABLE {weblinks} DROP tid
Failed: ALTER TABLE {weblinks} ADD `click_count` INT unsigned NOT NULL DEFAULT 0
Failed: ALTER TABLE {weblinks} ADD `last_click` INT unsigned DEFAULT 0

Update #6107
variable_set('weblinks_visit_text', Visitar [title] [title])

Update #6108
UPDATE {system} SET weight=-2 WHERE type='module' AND name='weblinks'

Update #6109
UPDATE {blocks} SET module='weblinks_blocks' WHERE module='weblinks'
peacog’s picture

It looks to me like this 6.x-2.4 release is actually 6.x-1.6. If you look in weblinks.install you'll see that the last hook_update_N is hook_update_6109, when it fact it should be hook_update_6116. Also, this version of weblinks.module is identical to the 6.x-1.6 version. It looks like something went wrong packaging up the new release.

gregarios’s picture

Unfortunately the release was not accompanied by a 6.x-2.x-dev update. I wish the maintainer would just fix it and release it correctly.

powery’s picture

subscribe

aa461’s picture

Subscribe

nancydru’s picture

IreneKraus’s picture

This is my problem too. On my one site, doing a complete removal and then re-install seems to have resolved most of the errors there. Oddly enough, the same did not occur when I did it on my own site! When I try to create a weblink now, I get these errors:

    user warning: Unknown column 'weight' in 'field list' query: SELECT url, weight, last_status, last_checked, click_count, last_click FROM weblinks WHERE nid = 151 AND vid=152 in (snip)/sites/all/modules/weblinks/weblinks.module on line 359.
    user warning: Unknown column 'weight' in 'field list' query: UPDATE weblinks SET vid=152, nid=151, url='http://filezilla-project.org/', weight=5, last_status='', last_checked=0, click_count=0, last_click=0 WHERE vid=152 AND nid=151 in (snip)/sites/all/modules/weblinks/weblinks.module on line 330.
    user warning: Unknown column 'weight' in 'field list' query: SELECT url, weight, last_status, last_checked, click_count, last_click FROM weblinks WHERE nid = 151 AND vid=152 in (snip)/sites/all/modules/weblinks/weblinks.module on line 359.

Before anyone asks, this was indeed supposed to be a weblink pointing to where one can download FileZilla. The link info keeps getting wiped out of the record when I go to save. It looks like I'm doing a database roll-back myself and sticking with the older version of this module!

andrebonfanti’s picture

+1

miguel_angel’s picture

Please, use the "Follow" button at top instead of empty comments, as NancyDru said at #15.

Thank you

gregarios’s picture

Looks like on Drupal's forums they've just substituted half the "subscribe" comments for "slap on the hand" comments by adding that "follow" button. I for one welcome the "subscribe" comments because it keeps important issues fresh in the list. ;-)

va3pc’s picture

Any fix for this yet? I finally upgraded to Drush on my D6 site a few months back, and didn't see anything untoward when upgrading until all the links vaporized. I dropped back a weblinks version and they all reappeared. Suffice to say I can't "drush up" again with impunity until this is resolved.

ronline’s picture

Does the maintainer feel concerned ? 20 days has gone and his official release is knocking out whole weblinks functionality.

dm2243’s picture

agreed - i have the same problem and i'm wondering why this version is still public. :(

miklosandras’s picture

Quick solution:

Go to phpmyadmin and execute this sql:

ALTER TABLE `weblinks` ADD `weight` VARCHAR( 30 ) NOT NULL;

Table name can be different (like, it can have prefix).
I don't know, what was the type of the column weight.

va3pc’s picture

Thanks for the tip, I updated the table and now I can save new links.
Cheers
Paul

Dr Faustus’s picture

More precisely, the SQL statement is:

ALTER TABLE `weblinks` ADD `weight` tinyint(4) NOT NULL DEFAULT '0';

If the backup_migrate module is installed, save a text file with the statement and restore it to solve the problem quickly

Cheers

kalanh’s picture

Title: 6.x-2.4 Database Update Fails (advice: Revert to 6.x-2.3) » 6.x-2.4 Database Update Fails

This SQL query posted earlier fixes the error message, but links but only display for admins through admin/content/weblinks. Also, the links-embed input filter no longer works, displaying instead the raw markers:

[links-embed: 2] [links-embed: 3] [links-embed: 4], etc.

I tried disabling and re-enabling the Web Links Filter sub-module and Weblinks parent module with no luck. In the end, I just restored a DB backup and reverted the previous Weblinks module source code.

gregarios’s picture

Title: 6.x-2.4 Database Update Fails » 6.x-2.4 Database Update Fails (advice: Revert to 6.x-2.3)

Any "fixes" for this will only be patches against 6.x-1.x...

I'm afraid the only "fix" possible is to re-submit the correct 6.x-2.4 version as 6.x-2.5, and this is entirely in the maintainer's hands since nobody has seen the changes that were supposed to occur in the 6.x-2.4 version.

This version, as Peacog wrote in comment #11 above, appears to be an older version submitted accidentally.

My advice to everyone is to revert back to version 6.x-2.3 and stop trying to fix this messed up archive submission.

izmeez’s picture

#11 & #27 - You are so right, this is a regression. See the repository viewer,
http://drupalcode.org/project/weblinks.git/shortlog/refs/tags/6.x-2.4

Anonymous’s picture

+1 subscribe

nancydru’s picture

gregarios’s picture

Hey NancyDru, maybe you could stop your campaign to get on people's cases about subscribing long enough to fix this module you are listed as a maintainer for? ;-)

nancydru’s picture

It is not MY campaign - it originated in core. If I didn't get useless email notices about people subscribing, I might have time to learn Git so I can get back to maintaining modules.

bdillahu’s picture

Title: 6.x-2.4 Database Update Fails » 6.x-2.4 Database Update Fails (advice: Revert to 6.x-2.3)

Just in case you're trying to recover from this, I also found that reverting to 2.3 and re-running the update.php script got me going again without having to back off the database. Not sure it's perfect, but gets my site back up.

elfcurry’s picture

I also reverted to 6.x-2.3 and ran update.php and it seems to work.

Wouldn't it make more sense NOT to recommend people to upgrade to 2.4 while this problem exists?

gregarios’s picture

Wouldn't it make more sense NOT to recommend people to upgrade to 2.4 while this problem exists?

People looking in the issues will most likely have already tried to upgrade. Those that look here first will also find this. It's a moot point. But since the issues are primarily for people already experiencing problems, then reverting to 6.x-2.3 would be the correct solution.

elfcurry’s picture

People looking in the issues will most likely have already tried to upgrade. Those that look here first will also find this. It's a moot point. But since the issues are primarily for people already experiencing problems, then reverting to 6.x-2.3 would be the correct solution.

I don't quite understand you.

I had a problem because my 'Available Updates' report recommends me to update to 6.x-2.4 but this is unhelpful while the version causes a problem. Maybe it doesn't affect all sites but I was on 2.3 which works, so I'd have done better to ignore the recommendation and stick with 2.3.

gregarios’s picture

Only the maintainer can update the Drupal module so your "Available Updates" can list the correct one. I'm hoping the maintainer updates this module correctly, immediately if not sooner. :-)

Feel free to contact him and complain.

verta’s picture

I am now "following" this issue as requested, but I find it more constructive to post that I to have experienced the problem and am more than happy to test any new release to see if it works better. I have been trying to get off dev releases where I can except real dev sites, and was not expecting it to blow up going from dev 2.2 to released 2.4.

hansrossel’s picture

Same issue here and quite obvious why it's not working, the .install file of 2.4 has only the db updates of version 1.4, wondering if this module is still maintained: #1468830: Is Weblinks still being maintained?. Also wondering what will happen to new sites that base themselves on this version with wrong database schema.

nancydru’s picture

I am still learning Git and need to take care of security issues in another module, then I'll try to fix this, if Robert doesn't get to it first.

mcurry’s picture

Bit in the behind by this, I was. Please, please, module maintainers: withdraw 2.4 as a recommended version until this is fixed. See: #1479538: Revert to 6.x-2.3 as recommended version until upgrade issues are resolved

hansrossel’s picture

@NancyDru, you don't need to know git to put a red message on the project page referring to this issue and asking people to install 2.3 and not upgrade to 2.4 until this issue is resolved.

nancydru’s picture

You are correct. Done.

gregarios’s picture

You could change the 2.4 release note to include "ALERT - DO NOT INSTALL THIS UPDATE - IT IS BROKEN!" as well.

nancydru’s picture

Done

gregarios’s picture

I know the basics of Git, and have made quite a number of updates to the Bad Behavior module using it over the last year. If you like, please make me a co-maintainer for this module so I can just put up the 2.3 version as a 2.5 and call it good. Or if you want to zip up and attach the real 2.4 to this thread as it was meant to go up I can use that. Would that work?

nancydru’s picture

I don't own this modules, so I can't set maintainers. I don't know if I have 2.4 as intended.

gregarios’s picture

Would you like me to give you a cheat sheet I use for running a standard update in Git? I can give you the exact steps I would take to get the 2.3 version to replace the current -dev version and create a new 2.5 out of it.

gregarios’s picture

Here is exactly what I would do if I were you. Use it with discretion as needed... there's nothing private in this anyway that isn't found on your profile page:

######## FIRST DOWNLOAD THE DEV RELEASE FOR UPDATING

cd /path/to/wherever/you/want/to/work/from
git clone --branch 6.x-2.x nancyw@git.drupal.org:project/weblinks.git
cd weblinks
git checkout 6.x-2.x

######## AT THIS POINT REPLACE ALL THE CLONED FILES WITH A
######## VALID 2.3 VERSION RELEASE's FILES, EXCEPT FOR THE ".info" FILE.

git status
git add -A
git config --global user.name "<your-drupal-visible-username>"
git config --global user.email "<your-drupal-email-address>"
git commit -m "Release to fix broken 6.x-2.3 commit."
git push -u origin 6.x-2.x

######## WAIT FOR DEV UPDATE TO SHOW ON DRUPAL SITE (About 12 hours)
######## THEN CREATE A NEW FULL RELEASE FROM DEV VERSION --
######## DELETE THE ENTIRE WEBLINKS DIRECTORY FROM YOUR
######## COMPUTER AND START OVER HERE:

cd /path/to/wherever/you/want/to/work/from
git clone --branch 6.x-2.x nancyw@git.drupal.org:project/weblinks.git
cd weblinks
git checkout 6.x-2.x
git status
git add -A
git config --global user.name "<your-drupal-visible-username>"
git config --global user.email "<your-drupal-email-address>"
git tag 6.x-2.5
git push -u origin 6.x-2.5

######## NOW MAKE THE 2.5 RELEASE ENTRY IN DRUPAL.ORG (http://drupal.org/node/add/project-release/84021  ??)

Let me know if you have any questions.

jonathan1055’s picture

I raised #1369850: contrib checker module missing or moved? back in December and if I recall, observed that the source code seems to have moved backwards to an older version. Maybe this was noted in the full thread above but I did not see it. Just posting this to see if it helps.
Jonathan

jonathan1055’s picture

Following on from my previous post, just spotted in #11 that this was noticed. I can confirm that .module and .install in the 2.4 release are identical to the 1.6 release of May 2009. Hope this is useful info. Let me know if I can do anything else to help.
Jonathan

lostchord’s picture

My problems with this module started when I upgraded from Drupal 6.22 to Drupal 6.24 while migrating from Fedora 14 to Fedora 15. I am seeing a number of other core related problems - mainly with the user module - that may be related to this. I run site specific modules directories and I did not update this module as part of the upgrade.

izmeez’s picture

Title: 6.x-2.4 Database Update Fails (advice: Revert to 6.x-2.3) » 6.x-2.4 update is really a downgrade to 6.x-1.x branch (advice: Revert to 6.x-2.3)

Thanks to earlier comments from others we never did "upgrade" to 6.x-2.4 which is clearly shown to be a git tagging error to the 6.x-1.x branch of this module. See comment #28

It would be really helpful if someone could simply remove that tag and reference to 6.x-2.4

Meanwhile I am changing the title to hopefully help people who have not read all the earlier comments in this thread.

nancydru’s picture

Well, let's see if we get a new -dev release in the morning.

gregarios’s picture

Somehow you let a patch file slip into the dev module...

nancydru’s picture

Proving my ignorance of Git. I think it's removed now. Other than that, how does the code look? It is still smaller than the 2.3 version.

gregarios’s picture

All I can say is it didn't give me any errors with the database update, and it does seem to be working. :) I have not put up any new links, however. Others should weigh in I suppose.

izmeez’s picture

Yes, the new weblinks-6.x-2.x-dev release updates without problems and appears to be working.

nancydru’s picture

Has anyone else tested? Anyone willing to mark this RTBC?

jonathan1055’s picture

I have tested the latest dev (at least the parts I use on my site) and it seems OK to me. I do not use any of the contribs apart from checker, just to let you know. Compared a couple of files, and the changes all seems reasonable. I am presuming that things were not committed to dev unless fairly well tested, so it should all be good to go.

I say yes, make a new release 2.5. I'd be happy to mark RTBC, if you are OK that I have only tested the core functions and checker.

Jonathan

nancydru’s picture

Status: Active » Fixed

6.x-2.5 is out

gregarios’s picture

Status: Fixed » Closed (fixed)

Thank you! I'll just put this baby to bed. :-)

mdlueck’s picture

@NancyDru, fix confirmed. Thank you so much! :-)

summit’s picture

Hi after 6.25, I still needed to do: http://drupal.org/node/1363410#comment-5457084

ALTER TABLE `weblinks` ADD `weight` tinyint(4) NOT NULL DEFAULT '0';

This to be able to use Web Links: Weight desc as a sort order within views.

Greetings, Martijn

nancydru’s picture

Martijn, please open this as a new issue. Include your "schema_version" value from the system table, please.

There should not be a "weight" column in the Weblinks table any more. I strongly encourage the use of the Weight module if you need that feature.

summit’s picture

Hi Nancy, thanks will do that!
Greetings, Martijn

summit’s picture

Issue summary: View changes

Removed IP