SQL syntax error Error
marcus0263 - February 23, 2009 - 08:30
| Project: | User Stats |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
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.

#1
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.)
#2
Idem :)
#3
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.
#4
Was this ever tested?
user_stats.install line 194:
CAST(pv.value AS INT)should be:
CAST(pv.value AS SIGNED)#5
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:
and:
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! :)
#6
Same error for me.
#7
@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.
#8
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 ;)
#9
Automatically closed -- issue fixed for 2 weeks with no activity.