Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19841

attempting to sort a multi-table query by ambiguous 'id' column name

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.6.24
    • Fix Version/s: None
    • Component/s: CiviContribute
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      Civi attempts to sort a multi-table query by an ambiguous column named 'id', causing an SQL error and backtrace. This issue occurs when clicking on the "view" link for a member's recurring contribution details.

      I have not seen the full SQL query, as it is elided in the debug output.

      Dec 29 16:30:32 [info] $backTrace = #0 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/Error.php(914): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error))
      #2 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #4 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #5 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...", "DB_Error", TRUE)
      #6 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "1052 ** Column 'id' in order clause is ambiguous")
      #7 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
      #8 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #9 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #10 /var/www/drupal-7.27/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #11 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/DAO.php(321): DB_DataObject->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #12 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/DAO.php(1181): CRM_Core_DAO->query("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...", TRUE)
      #13 /var/www/drupal-7.27/sites/all/modules/civicrm/api/v3/utils.php(678): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`,...")
      #14 /var/www/drupal-7.27/sites/all/modules/civicrm/api/v3/Contribution.php(231): _civicrm_api3_get_query_object((Array:5), 2, "Contribution")
      #15 /var/www/drupal-7.27/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_contribution_get((Array:5))
      #16 /var/www/drupal-7.27/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
      #17 /var/www/drupal-7.27/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("Contribution", "get", (Array:5), NULL)
      #18 /var/www/drupal-7.27/sites/all/modules/civicrm/api/api.php(43): civicrm_api("Contribution", "get", (Array:5))
      #19 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Contribute/BAO/ContributionRecur.php(449): civicrm_api3("Contribution", "get", (Array:4))
      #20 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Contribute/BAO/ContributionRecur.php(429): CRM_Contribute_BAO_ContributionRecur::getTemplateContribution("34")
      #21 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Contribute/Page/ContributionRecur.php(71): CRM_Contribute_BAO_ContributionRecur::supportsFinancialTypeChange("34")
      #22 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Contribute/Page/ContributionRecur.php(113): CRM_Contribute_Page_ContributionRecur->view()
      #23 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Contribute_Page_ContributionRecur->run((Array:4), NULL)
      #24 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
      #25 /var/www/drupal-7.27/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:4))
      #26 /var/www/drupal-7.27/sites/all/modules/civicrm/drupal/civicrm.module(482): CRM_Core_Invoke::invoke((Array:4))
      #27 [internal function](): civicrm_invoke("contact", "view", "contributionrecur")
      #28 /var/www/drupal-7.27/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:3))
      #29 /var/www/drupal-7.27/index.php(21): menu_execute_active_handler()
      #30

      Unknown macro: {main}

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sudoman Andrew Engelbrecht
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: