Forgotten "VALUES" on subscriptions.module line 145, it should be in:

case 'insert':
db_query("INSERT INTO {subscriptions_user} VALUES (uid, digest, last_sent) (%d, 0, 0)", $account->uid);
break;

Comments

salvis’s picture

Title: Mysql error on user insert » Mysql error on user insert: INSERT INTO subscriptions_user ...
Version: 5.x-2.0-beta3 » 5.x-2.0-beta4
Status: Needs review » Fixed

Yes, this is a nasty bug, thanks for reporting it. It's fixed in BETA4.

If you've added any users, you must manually insert those records:

INSERT INTO subscriptions_user  (uid, digest, last_sent) VALUES(UID, 0, 0);

where UID stands for every user that was created (look at the users table) and didn't get a corresponding record in subscriptions_user.

If you don't do this, then Subscriptions will cause more errors for those users!

gustav’s picture

Salvis, can you clarify who needs to add these entries into the subscriptions_user table? Everyone who upgrades to the new beta and already has users on the site? In that case, shouldn't this be done by the upgrade script?

salvis’s picture

Add the entries (see #1) if you have installed any of the beta versions AND added new users between installing that beta and updating to BETA4.

You can simply compare the uid values in the users table and the subscriptions_user table — they should be paired. Since they're added in increasing order, you can simply compare

SELECT MAX(uid) FROM users;

with

SELECT MAX(uid) FROM subscriptions_user;

If they're the same, you're fine; if not, you need to add records to subscriptions_user to bring it to the level of users.

If you have database prefixes, you need to use them, of course.

gustav’s picture

Thank you, that was very clear and helpful.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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