progressivetech / net.ourpowerbase.sumfields

The Summary Fields extension creates read-only custom data fields that extend Contact and are automatically populated with up-to-date totals such as total lifetime contributions, last contribution amount, last attended event, etc.
Other
8 stars 29 forks source link

Gendata: DB Error: value count on row #90

Open masetto opened 3 years ago

masetto commented 3 years ago

Hello, I have this error after executing Gendata cron job.

Fatal Error Details = array:3 [
  "message" => "DB Error: value count on row"
  "code" => null
  "exception" => PEAR_Exception {#4302
    #cause: DB_Error {#4315
      +error_message_prefix: ""
      +mode: 16
      +level: 1024
      +code: -22
      +message: "DB Error: value count on row"
      +userinfo: """
        INSERT INTO `civicrm_tmp_e_dflt_cab8752fb17d0ee8e6a06e0aa78224e0` SELECT contact_id, MAX((SELECT IF(SUM(total_amount) IS NULL, 0, SUM(total_amount))\n
              FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id AND t1.is_test = 0 \n
              AND t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2))),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2021-01-01"\n
              AND "2021-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN DATE_SUB(NOW(), INTERVAL 12 MONTH) AND NOW()\n
              AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
              t1.financial_type_id = t2.id AND is_deductible = 1\n
              WHERE CAST(receive_date AS DATE) BETWEEN "2021-01-01" AND\n
              "2021-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2020-01-01"\n
              AND "2020-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
              t1.financial_type_id = t2.id AND is_deductible = 1\n
              WHERE CAST(receive_date AS DATE) BETWEEN "2020-01-01" AND\n
              "2020-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2019-01-01"\n
              AND "2019-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0)\n
              FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
              t1.financial_type_id = t2.id AND is_deductible = 1\n
              WHERE CAST(receive_date AS DATE) BETWEEN "2019-01-01" AND\n
              "2019-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(total_amount,0)\n
              FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id\n
              AND t1.contribution_status_id = 1  AND t1.financial_type_id IN\n
              (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0 ORDER BY t1.receive_date DESC LIMIT 1)),\n
        MAX((SELECT COALESCE(total_amount,0)\n
              FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id\n
              AND t1.contribution_status_id = 1  AND t1.financial_type_id IN\n
              (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0 ORDER BY t1.receive_date ASC LIMIT 1)),\n
        MAX((SELECT COALESCE(MAX(total_amount), 0)\n
              FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id AND\n
              t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(COUNT(id), 0) FROM civicrm_contribution t1\n
              WHERE t1.contact_id = trigger_table.contact_id AND t1.contribution_status_id = 1 AND\n
              t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
        MAX((SELECT COALESCE(SUM(total_amount),0) / (SELECT NULLIF(COUNT(DISTINCT SUBSTR(receive_date, 1, 4)), 0)\n
              FROM civicrm_contribution t0 WHERE t0.contact_id = trigger_table.contact_id AND t0.financial_type_id\n
              IN (5,3,9,1,7,8,6,4,2) AND t0.contribution_status_id = 1 and t0.is_test = 0) FROM civicrm_contribution t1\n
              WHERE t1.contact_id = trigger_table.contact_id AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2)\n
              AND t1.contribution_status_id = 1 AND t1.is_test = 0)) FROM `civicrm_contribution` AS trigger_table  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
        """
      +backtrace: array:29 [
        0 => array:6 [
          "file" => "/var/www/vhosts/aiutobambinibetlemme.it/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php"
          "line" => 997
          "function" => "__construct"
          "class" => "PEAR_Error"
          "type" => "->"
          "args" => array:5 [
            0 => "DB Error: value count on row"
            1 => -22
            2 => 16
            3 => array:2 [
              0 => "CRM_Core_Error"
              1 => "exceptionHandler"
            ]
            4 => """
              INSERT INTO `civicrm_tmp_e_dflt_cab8752fb17d0ee8e6a06e0aa78224e0` SELECT contact_id, MAX((SELECT IF(SUM(total_amount) IS NULL, 0, SUM(total_amount))\n
                    FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id AND t1.is_test = 0 \n
                    AND t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2))),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2021-01-01"\n
                    AND "2021-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN DATE_SUB(NOW(), INTERVAL 12 MONTH) AND NOW()\n
                    AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
                    t1.financial_type_id = t2.id AND is_deductible = 1\n
                    WHERE CAST(receive_date AS DATE) BETWEEN "2021-01-01" AND\n
                    "2021-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2020-01-01"\n
                    AND "2020-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
                    t1.financial_type_id = t2.id AND is_deductible = 1\n
                    WHERE CAST(receive_date AS DATE) BETWEEN "2020-01-01" AND\n
                    "2020-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 WHERE CAST(receive_date AS DATE) BETWEEN "2019-01-01"\n
                    AND "2019-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0)\n
                    FROM civicrm_contribution t1 JOIN civicrm_financial_type t2 ON\n
                    t1.financial_type_id = t2.id AND is_deductible = 1\n
                    WHERE CAST(receive_date AS DATE) BETWEEN "2019-01-01" AND\n
                    "2019-12-31" AND t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(total_amount,0)\n
                    FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id\n
                    AND t1.contribution_status_id = 1  AND t1.financial_type_id IN\n
                    (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0 ORDER BY t1.receive_date DESC LIMIT 1)),\n
              MAX((SELECT COALESCE(total_amount,0)\n
                    FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id\n
                    AND t1.contribution_status_id = 1  AND t1.financial_type_id IN\n
                    (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0 ORDER BY t1.receive_date ASC LIMIT 1)),\n
              MAX((SELECT COALESCE(MAX(total_amount), 0)\n
                    FROM civicrm_contribution t1 WHERE t1.contact_id = trigger_table.contact_id AND\n
                    t1.contribution_status_id = 1 AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(COUNT(id), 0) FROM civicrm_contribution t1\n
                    WHERE t1.contact_id = trigger_table.contact_id AND t1.contribution_status_id = 1 AND\n
                    t1.financial_type_id IN (5,3,9,1,7,8,6,4,2) AND t1.is_test = 0)),\n
              MAX((SELECT COALESCE(SUM(total_amount),0) / (SELECT NULLIF(COUNT(DISTINCT SUBSTR(receive_date, 1, 4)), 0)\n
                    FROM civicrm_contribution t0 WHERE t0.contact_id = trigger_table.contact_id AND t0.financial_type_id\n
                    IN (5,3,9,1,7,8,6,4,2) AND t0.contribution_status_id = 1 and t0.is_test = 0) FROM civicrm_contribution t1\n
                    WHERE t1.contact_id = trigger_table.contact_id AND t1.financial_type_id IN (5,3,9,1,7,8,6,4,2)\n
                    AND t1.contribution_status_id = 1 AND t1.is_test = 0)) FROM `civicrm_contribution` AS trigger_table  GROUP BY contact_id [nativecode=1136 ** Column count doesn't match value count at row 1]
              """
          ]
        ]

I can't figure out what it is. I don't like to uninstall the extension because there are several smart groups configured.

masetto commented 3 years ago

I created this pull request.