Closed twomice closed 5 years ago
I'm getting a very similar error when I try to save the Summary Fields settings form, but I don't think it's the first time the form has been saved. CiviCRM 4.6.33, Summary Fields 3.1.1 OR 3.1.3.
I suspect this is a 4.6 error (since I can't replicate in 4.7). Do you also get "Column count doesn't match value count at row 1, 1136"? That error suggests that somehow we are mis-counting the number of fields that should be in the temporary table. I'm not sure how that is happening or why it would only happen in 4.6.
I suspect this is a 4.6 error (since I can't replicate in 4.7).
I've not seen this error on any 4.7 sites yet either. I'll try to find another 4.6 site where I can try to replicate the error.
Do you also get "Column count doesn't match value count at row 1, 1136"?
Yup. Here's what I see in my Civi log:
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -22
[message] => DB Error: value count on row
[mode] => 16
[debug_info] => INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
[type] => DB_Error
[user_info] => INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
[to_string] => [db_error: message="DB Error: value count on row" code=-22 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO `civicrm_temp_8dfa5208b74031ed1747c3ad2de645dd` SELECT contact_id, (SELECT civicrm_event.title AS summary_value
FROM civicrm_participant t1 JOIN civicrm_event ON t1.event_id = civicrm_event.id
WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND civicrm_event.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT e.start_date AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15) ORDER BY start_date DESC LIMIT 1),
(SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (2)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value),
(SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)),
(SELECT FORMAT(IFNULL((SELECT COUNT(e.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE t1.contact_id = t2.contact_id AND t1.status_id IN (3)
AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0) / IFNULL((SELECT COUNT(t1.id) AS summary_value FROM civicrm_participant t1 JOIN civicrm_event e ON
t1.event_id = e.id WHERE contact_id = t2.contact_id AND e.event_type_id IN (1,9,8,7,3,4,5,6,10,11,12,13,14,15)), 0), 2) * 100 AS summary_value) FROM `civicrm_participant` AS t2 JOIN civicrm_contact AS c ON t2.contact_id = c.id GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]"]
)
That error suggests that somehow we are mis-counting the number of fields that should be in the temporary table. I'm not sure how that is happening or why it would only happen in 4.6.
Hmm. Any idea whether one can safely blow away that temporary table to try to overcome the error? No idea where that table comes from so don't know what the other ramifications might be, but I may try that on a test site!
Hmm. Any idea whether one can safely blow away that temporary table to try to overcome the error? No idea where that table comes from so don't know what the other ramifications might be, but I may try that on a test site!
Found that I can't "blow away" a temporary table that is temporary and seems to only exist while the SumFields settings page is being saved. :)
I checked out a few other CiviCRM 4.6.x sites with Summary Fields installed and none of them have this problem. Unsure of how to proceed from here!
This is mysterious. The code should be reading the configuration from custom.php and creating a temporary table with a field for each record in custom.php that is enabled in your configuration, has trigger_table set to civicrm_participant, and has a trigger_sql field. Then, it should insert the results of each sql statement into this table.
Can you take a screen shot of the Events section of your sumfields settings page on the site with this problem? I wonder if there is some combination of settings that might be causing the problem?
Another idea would be to disable and uninstall the extension and try it again with the same settings- this isn't a rational suggestion :) - but it seems to work a lot.
Hi hullo, working with Jack on the same site. Can confirm uninstalling and re-installing either 3.1.1 or 3.1.3 produces the same error.
Screenshot attached. I removed some custom event types from this screen for privacy but we're trying to save for all event types. This site does have custom participant statuses that are not shown and don't need to be part of the calculations, not sure if that might be a factor. Site also has civi database logging enabled.
Sorry I dropped the ball on this. Are you still having this trouble? See https://github.com/progressivetech/net.ourpowerbase.sumfields/issues/42 for some steps I recently went through to fully rid a system of summary fields so it could be re-installed.
Thanks for checking up on this! This particular issue has not recurred for me at least. I have had to manually delete the summary fields tables and related log tables as you describe, when moving a site recently. But unfortunately I didn't take very detailed notes of what happened when I ran into that issue.
Thanks for the update. I will consider this issue closed then.
CiviCRM version: 4.6, with debugging and backtraces enabled.
To reproduce: