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) »
  • Developer Discussion »
  • Report and Search UI Discussion (Moderators: CiviTeacher.com, TwoMice) »
  • DB Error when search builder involves location type
Pages: [1]

Author Topic: DB Error when search builder involves location type  (Read 508 times)

alainb

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal
  • MySQL version: 5.x
  • PHP version: 5.x
DB Error when search builder involves location type
April 13, 2015, 08:55:04 am
I get the DB Error "no such field" when I use the Search Builder to look for contacts whose email of a certain location type matches a certain criterion.
e.g. email of location type "Work" is not null.
Other searches work fine. Only when it involves a location type it fails, except when the location type is "Primary".

I guess it's due to my data, because I don't have this error in e.g. the civi sandbox. But it would be great if I could solve this error in our production environment.

Can anyone help with finding the cause of this error? (I'm using civicrm 4.4.10 in Dutch)

This is the error message:
Notice: Undefined index: Nieuwsbrief-email in CRM_Contact_BAO_Query->restWhere() (regel 2101 van /home/alain/public_html/vkw/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php).

Here's the debug error:
Database Error Code: Unknown column 'Nieuwsbrief-email.email' in 'where clause', 1054
Additional Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -19
    [message] => DB Error: no such field
    [mode] => 16
    [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( LOWER(`Nieuwsbrief-email`.email) IS NOT NULL )  )  AND (contact_a.is_deleted = 0)    ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc  [nativecode=1054 ** Unknown column 'Nieuwsbrief-email.email' in 'where clause']
    [type] => DB_Error
    [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( LOWER(`Nieuwsbrief-email`.email) IS NOT NULL )  )  AND (contact_a.is_deleted = 0)    ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc  [nativecode=1054 ** Unknown column 'Nieuwsbrief-email.email' in 'where clause']
    [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( LOWER(`Nieuwsbrief-email`.email) IS NOT NULL )  )  AND (contact_a.is_deleted = 0)    ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc  [nativecode=1054 ** Unknown column 'Nieuwsbrief-email.email' in 'where clause']"]
)


FYI:
"Nieuwsbrief" is the name of a location type.

Thanks.

Alain

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Report and Search UI Discussion (Moderators: CiviTeacher.com, TwoMice) »
  • DB Error when search builder involves location type

This forum was archived on 2017-11-26.