Hello there

I have installed ad, image, embed, html and report modules. Randomly going through the site, I get many times this kind of error:

user warning: Unknown column 'extra' in 'where clause' query: UPDATE ad_statistics SET count = count + 1 WHERE aid = 106 AND action = 'view' AND date = 2009042317 AND adgroup = 't20' AND extra = '' AND hostid = '' in .../sites/all/modules/ad/adcache.inc on line 299.

I get one per each ad I create, but it doesn't show always. It shows for every registered user (if it were only per administrators would'n be a critical thing). I have checked adcache.inc, and it reads

db_query("UPDATE {ad_statistics} SET count = count + 1 WHERE aid = %d AND action = '%s' AND date = %d AND adgroup = '%s' AND extra = '%s' AND hostid = '%s'", $aid, $action, date('YmdH'), adserve_variable('group'), $extra, $hostid);
  // if column doesn't already exist, add it

Would it be enough just creating the column in the DB manually? I also found the issue http://drupal.org/node/422936#comment-1511446, which looks similar to me, so maybe the sollutions runs in the same way.

Comments

jeremy’s picture

Status: Active » Closed (duplicate)
jeremy’s picture

I see you've already seen that issue. Yes, the fix is the same, force update 6004 to run to solve the problem.

dresde’s picture

Sweet! It works perfectly, thank you very much!

czeky’s picture

sory for maybe stupid question, but what is force update 6004? thanx

czeky’s picture

anyone? thanx

jeremy’s picture

This means going to update.php, and when it lists updates manually select update 6004 for the update:
http://api.drupal.org/api/drupal/update.php/6

czeky’s picture

Hi, thanx
updating 6004 gives me errors

-----------------

user warning: Duplicate column name 'extra' query: ALTER TABLE realitka_ad_statistics ADD `extra` VARCHAR(255) NOT NULL DEFAULT '', ADD INDEX extra (extra) in /data/bigreality.cz/www_data/www/includes/database.mysql-common.inc on line 298.
user warning: Duplicate column name 'extra' query: ALTER TABLE realitka_ad_clicks ADD `extra` VARCHAR(255) NOT NULL DEFAULT '', ADD INDEX extra (extra) in /data/bigreality.cz/www_data/www/includes/database.mysql-common.inc on line 298.
user warning: Duplicate key name 'aid_date_action' query: ALTER TABLE realitka_ad_statistics ADD INDEX aid_date_action (aid, date, action) in /data/bigreality.cz/www_data/www/includes/database.mysql-common.inc on line 434.
user warning: Can't DROP 'aid'; check that column/key exists query: ALTER TABLE realitka_ad_statistics DROP INDEX aid in /data/bigreality.cz/www_data/www/includes/database.mysql-common.inc on line 448.
user warning: Unknown column 'no_channel_weight' in 'realitka_ad_channel' query: ALTER TABLE realitka_ad_channel CHANGE COLUMN no_channel_weight no_channel_percent INT(3) NOT NULL DEFAULT '0' in /data/bigreality.cz/www_data/www/sites/all/modules/ad/channel/ad_channel.install on line 228.
user warning: Duplicate column name 'inventory' query: ALTER TABLE realitka_ad_channel ADD inventory INT(11) in /data/bigreality.cz/www_data/www/sites/all/modules/ad/channel/ad_channel.install on line 246.
user warning: Table 'realitka_ad_channel_remnant' already exists query: CREATE TABLE realitka_ad_channel_remnant (aid INT(11) UNSIGNED NOT NULL DEFAULT '0', remnant TINYINT UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (aid, remnant)) in /data/bigreality.cz/www_data/www/sites/all/modules/ad/channel/ad_channel.install on line 247.

---------------

and

---------------

The following queries were executed
ad module
Update #6004
Failed: ALTER TABLE {ad_statistics} ADD `extra` VARCHAR(255) NOT NULL DEFAULT '', ADD INDEX extra (extra)
Failed: ALTER TABLE {ad_clicks} ADD `extra` VARCHAR(255) NOT NULL DEFAULT '', ADD INDEX extra (extra)
Update #6005
No queries
Update #6006
No queries
Update #6007
Failed: ALTER TABLE {ad_statistics} ADD INDEX aid_date_action (aid, date, action)
Failed: ALTER TABLE {ad_statistics} DROP INDEX aid
Update #6008
UPDATE {blocks} SET cache = 4 WHERE module = 'ad'
ad_channel module
Update #6004
Failed: ALTER TABLE {ad_channel} CHANGE COLUMN no_channel_weight no_channel_percent INT(3) NOT NULL DEFAULT '0'
UPDATE {ad_channel} SET no_channel_percent=20 WHERE no_channel_percent=25
UPDATE {ad_channel} SET no_channel_percent=25 WHERE no_channel_percent=33
UPDATE {ad_channel} SET no_channel_percent=35 WHERE no_channel_percent=50
UPDATE {ad_channel} SET no_channel_percent=50 WHERE no_channel_percent=100
UPDATE {ad_channel} SET no_channel_percent=65 WHERE no_channel_percent=200
UPDATE {ad_channel} SET no_channel_percent=75 WHERE no_channel_percent=300
UPDATE {ad_channel} SET no_channel_percent=80 WHERE no_channel_percent=400
Update #6005
Failed: ALTER TABLE {ad_channel} ADD inventory INT(11)
Failed: CREATE TABLE {ad_channel_remnant} (aid INT(11) UNSIGNED NOT NULL DEFAULT '0', remnant TINYINT UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (aid, remnant))

-----------------

can You help please?

than You