CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
Pages: [1]

Author Topic: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054  (Read 1756 times)

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
September 17, 2011, 07:21:31 pm
Hello!

For an online registration, choosing pay by paypal, the registration completes successfully, however when the choice to pay later (by check for example) is made then the registration fails on a Database Error Code: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054.

I have checked the database and civicrm_event.event_type_id is present in the database.

Looking at the query, there is a mistake: civicrm_event is NOT referenced as a table in a JOIN, but referenced in an ON statement.

I have tried reproducing this on the demo site with a similar registration - there it works fine.  This is running on CiviCRM 3.4.5, Drupal 6.22.

Please, any suggestions of what I can do?  Thanks very much!


Code: [Select]
SELECT DISTINCT(contact_a.id) as contact_id, `1-location_type`.id as `1-location_type_id`, `1-location_type`.name as `1-location_type`, `1-email`.id as `1-email_id`, `1-email`.email as `1-email`, `1-address`.id as `1-address_id`, `1-address`.supplemental_address_1 as `1-supplemental_address_1`, `1-address`.city as `1-city`, `1-phone-1`.id as `1-phone-1_id`, `1-phone-1`.phone as `1-phone-1`, `1-country`.id as `1-country_id`, `1-country`.name as `1-country`, `Home-location_type`.id as `Home-location_type_id`, `Home-location_type`.name as `Home-location_type`, `Home-address`.id as `Home-address_id`, `Home-address`.street_address as `Home-street_address`, `Home-state_province`.id as `Home-state_province_id`, `Home-state_province`.abbreviation as `Home-state_province`, civicrm_participant.id as participant_id, event_type.label as event_type, civicrm_note.note as participant_note 
FROM civicrm_contact contact_a
LEFT JOIN civicrm_address `1-address` ON (`1-address`.contact_id = contact_a.id AND `1-address`.is_primary = 1) 
LEFT JOIN civicrm_address `Home-address` ON (`Home-address`.contact_id = contact_a.id AND `Home-address`.location_type_id = 1) 
LEFT JOIN civicrm_state_province `Home-state_province` ON `Home-state_province`.id = `Home-address`.state_province_id 
LEFT JOIN civicrm_country `1-country` ON `1-country`.id = `1-address`.country_id 
LEFT JOIN civicrm_email `1-email` ON contact_a.id = `1-email`.contact_id AND `1-email`.is_primary = 1 
LEFT JOIN civicrm_phone `1-phone-1` ON contact_a.id = `1-phone-1`.contact_id AND `1-phone-1`.is_primary = 1 AND ( `1-phone-1`.phone_type_id = '1' OR `1-phone-1`.phone_type_id IS NULL )   
LEFT JOIN civicrm_location_type `1-location_type` ON (  ( `1-email`.location_type_id = `1-location_type`.id )OR ( `1-address`.location_type_id = `1-location_type`.id ) OR ( `1-phone-1`.location_type_id = `1-location_type`.id ) ) 
LEFT JOIN civicrm_location_type `Home-location_type` ON (  ( `Home-address`.location_type_id = `Home-location_type`.id )  ) 
LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type')
LEFT JOIN civicrm_option_value `event_type` ON (civicrm_event.event_type_id = `event_type`.value AND option_group_event_type.id = `event_type`.option_group_id ) 
LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_participant' AND civicrm_participant.id = civicrm_note.entity_id )
WHERE  ( contact_a.id = 1433 AND civicrm_participant.id = 73 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)   
GROUP BY contact_a.id   

karunadave

  • I post occasionally
  • **
  • Posts: 50
  • Karma: 0
    • Karuna Dev
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 6.30 or Drupal 7.26 Drush 6.2.0
  • MySQL version: 5.5.35-cll - MySQL Community Server (GPL)
  • PHP version: 5.3.21
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
September 17, 2011, 09:31:53 pm
Here is the backtrace for this:

Code: [Select]
backTrace


public_html/drupal6/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 159
, handle,
public_html/drupal6/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 931
public_html/drupal6/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 968
public_html/drupal6/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 564
public_html/drupal6/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
public_html/drupal6/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
public_html/drupal6/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
public_html/drupal6/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
public_html/drupal6/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2424
public_html/drupal6/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1610
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 147
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 874
public_html/drupal6/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php, executeQuery, 3602
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php, searchQuery, 735
public_html/drupal6/sites/all/modules/civicrm/CRM/Event/BAO/Event.php, getValues, 1213
public_html/drupal6/sites/all/modules/civicrm/CRM/Event/BAO/Event.php, buildCustomDisplay, 1010
public_html/drupal6/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php, sendMail, 785
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 250
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/StateMachine.php, mainProcess, 167
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 64
public_html/drupal6/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
public_html/drupal6/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 284
public_html/drupal6/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 223
public_html/drupal6/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 363
, civicrm_invoke,
public_html/drupal6/includes/menu.inc, call_user_func_array, 349
public_html/drupal6/index.php, menu_execute_active_handler, 17

denverdataman

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 2
    • Denver DataMan Website
  • CiviCRM version: Several
  • CMS version: Drupal 6/7
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
January 10, 2013, 02:55:48 pm
Did you find a solution to this?

Thanks,
Steve
Steve Kessler
Owner and Lead Consultant of Denver DataMan

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
January 10, 2013, 03:09:24 pm
Looks like the civicrm_event table is not being joined into that query - don't suppose you can upgrade to the latest version - I expect that has been fixed
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

denverdataman

  • I post occasionally
  • **
  • Posts: 93
  • Karma: 2
    • Denver DataMan Website
  • CiviCRM version: Several
  • CMS version: Drupal 6/7
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
January 10, 2013, 03:13:58 pm
That is how we tried to solve the site that now was 4.2.7 and that did not solve that problem.

Thanks,
Steve
Steve Kessler
Owner and Lead Consultant of Denver DataMan

kreynen

  • I post occasionally
  • **
  • Posts: 105
  • Karma: 8
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
January 14, 2013, 02:47:09 pm
I've run into this same error on another site running 4.2.7.

I can temporarily resolve the problem by adding an inner join to civicrm_event in the event_type case of CRM/Event/BAO/Query.php

Code: [Select]
case 'event_type':
        $from = " INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id ";
        $from .= " $side JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type')";
        $from .= " $side JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id ) ";
        break;
     

Unfortunately this change causes duplicate join errors in other queries.

I don't understand what's happening in the static function from() well enough to come up with a real fix, but hopefully narrowing this down to this point will make this a quick fix for someone else.

kreynen

  • I post occasionally
  • **
  • Posts: 105
  • Karma: 8
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
February 04, 2013, 01:33:16 pm
Backtrace...

Code: [Select]
#0 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/Error.php(148): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/[SITE]/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB.php(968): PEAR_Error->PEAR_Error("DB Error: no such field", -19, 16, (Array:2), "SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#4 /var/www/[SITE]/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-19, 16, (Array:2), "SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#5 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/common.php(1903): PEAR->raiseError(NULL, -19, NULL, NULL, "SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...", "DB_Error", TRUE)
#6 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'civicrm_event.event_type_id' in 'on clause'")
#7 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
#8 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#9 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#10 /var/www/[SITE]/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#11 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/DAO.php(155): DB_DataObject->query("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#12 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/DAO.php(922): CRM_Core_DAO->query("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...", TRUE)
#13 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(3985): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, `1-location_type`.id as `1-location_type_i...")
#14 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php(739): CRM_Contact_BAO_Query->searchQuery()
#15 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Event/BAO/Event.php(1246): CRM_Core_BAO_UFGroup::getValues("12479", (Array:5), (Array:0), FALSE, (Array:1))
#16 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Event/BAO/Event.php(1050): CRM_Event_BAO_Event::buildCustomDisplay("26", "customPre", "12479", Object(CRM_Core_Smarty), 349, FALSE, NULL, (Array:25))
#17 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(857): CRM_Event_BAO_Event::sendMail("12479", (Array:8), 349, FALSE)
#18 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/Form.php(246): CRM_Event_Form_Registration_Confirm->postProcess()
#19 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/StateMachine.php(159): CRM_Core_Form->mainProcess()
#20 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")
#21 /var/www/[SITE]/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")
#22 /var/www/[SITE]/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")
#23 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/Controller.php(289): HTML_QuickForm_Page->handle("next")
#24 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/Invoke.php(220): CRM_Core_Controller->run((Array:3), NULL)
#25 /var/www/[SITE]/sites/all/modules/civicrm/CRM/Core/Invoke.php(51): CRM_Core_Invoke::_invoke((Array:3))
#26 /var/www/[SITE]/sites/all/modules/civicrm/drupal/civicrm.module(500): CRM_Core_Invoke::invoke((Array:3))
#27 [internal function](): civicrm_invoke("event", "register")
#28 /var/www/[SITE]/includes/menu.inc(516): call_user_func_array("civicrm_invoke", (Array:2))
#29 /var/www/[SITE]/index.php(21): menu_execute_active_handler()
#30 {main}

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054
February 04, 2013, 02:37:45 pm

kevin:

do u have a deterministic sequence of steps to reproduce this on 4.2.7

if so, we can track and fix

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Unknown column 'civicrm_event.event_type_id' in 'on clause', 1054

This forum was archived on 2017-11-26.