Just updated to Beta 1 and received this sql error

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INT) FROM drupal_profile_fields pf INNER JOIN drupal_profile_values pv ON pf' at line 2 query: INSERT INTO drupal_user_stats_values (name, uid, value) SELECT 'login_count', pv.uid, CAST(pv.value AS INT) FROM drupal_profile_fields pf INNER JOIN drupal_profile_values pv ON pf.fid = pv.fid WHERE pf.name = 'user_login_count' in /xxxxx/xxxxxxx/drupal-6.9/sites/all/modules/user_stats/user_stats.install on line 196.

Comments

Critical Tinkerer’s picture

I got the same error when I ran update.php.

The updater went on to report the following:

The following queries were executed
user_stats module
Update #6101

    * CREATE TABLE {user_stats_values} ( `name` VARCHAR(128) NOT NULL DEFAULT '', `uid` INT unsigned NOT NULL DEFAULT 0, `value` INT NOT NULL DEFAULT 0, PRIMARY KEY (name, uid) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
    * CREATE TABLE {user_stats_ips} ( `iid` INT NOT NULL auto_increment, `uid` INT unsigned NOT NULL DEFAULT 0, `ip_address` VARCHAR(15) NOT NULL DEFAULT '', `first_seen_timestamp` INT NOT NULL DEFAULT 0, PRIMARY KEY (iid), INDEX uid (uid), INDEX first_seen_timestamp (first_seen_timestamp) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
    * Failed: INSERT INTO {user_stats_values} (name, uid, value) SELECT 'login_count', pv.uid, CAST(pv.value AS INT) FROM {profile_fields} pf INNER JOIN {profile_values} pv ON pf.fid = pv.fid WHERE pf.name = 'user_login_count'
    * INSERT INTO {user_stats_ips} (uid, ip_address) SELECT pv.uid, pv.value FROM {profile_fields} pf INNER JOIN {profile_values} pv ON pf.fid = pv.fid WHERE pf.name = 'user_ip_address'
    * DELETE FROM {profile_values} WHERE fid = 14
    * DELETE FROM {profile_values} WHERE fid = 15
    * DELETE FROM {profile_values} WHERE fid = 16
    * DELETE FROM {profile_fields} WHERE name IN ('user_post_count', 'user_ip_address', 'user_login_count')

(Note the "Failed" error.)

Junro’s picture

Idem :)

Junro’s picture

I had to restore a backup....

Fatal error: Cannot redeclare user_stats_preprocess_author_pane() (previously declared in /home/pariscin/www/sites/all/modules/user_stats/user_stats.module:691) in /home/pariscin/www/sites/all/modules/user_stats/user_stats.author-pane.inc on line 21

Got this with all pages.

gaele’s picture

Was this ever tested?

user_stats.install line 194:

CAST(pv.value AS INT)

should be:

CAST(pv.value AS SIGNED)

Liam McDermott’s picture

Priority: Normal » Critical
Status: Active » Fixed

Was this ever tested?

Obviously not. I did as much testing as I could think of during development (but using PostgreSQL, where it works perfectly), Then put up a -dev version on the project page and asked people to test the module out. I left it like this for seven days, before creating a release with a note in both the release notes and on the project page saying:

Warning: the beta release may contain bugs, and while the previous User Stats Alpha2 is crusty, it is known to work. Only deploy the User Stats Beta version to your site if you have ten minutes free to test it out first!

and:

please test this works for you before upgrading!

Seriously, there's no way to test contrib code other than just pushing it out and seeing what bugs are raised. Please don't whinge, I gave fair warning, asked people to test the -dev version and advised people to test the beta before deploying it on live sites!

So, no, it wasn't tested! :)

digemall’s picture

Priority: Critical » Normal
Status: Fixed » Active

Same error for me.

Liam McDermott’s picture

@digemail: wow, we must have posted at exactly the same time and your post reset the status. Fixing. :)

I've created a new release, which will be on the project front page in the next five minutes, or so.

digemall’s picture

Priority: Normal » Critical
Status: Active » Fixed

Amazing ! :P

thx for the fix, I'll test it now.
And I hope the bug with author_pane integration it's fixed too, otherwise I'll report to you immediately ;)

Status: Fixed » Closed (fixed)

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