Answers.Body: <p>Tested the fix from <a href="https://github.com/civicrm/civicrm-core/pull/17622" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/17622</a> &amp; can confirm it's now working as expected.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-15T16:50:28.270Z
Answers.Text: We just started experiencing this error in 5.29.0, is anyone who previously had this issue experiencing a regression, or is there possibly a new error now? (we went from 5.25 to 5.27 so never experienced this previously)
Answers.UserDisplayName: freeform.steph
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-16T14:42:44.220Z
Answers.LastActivityDate: 2020-06-16T14:42:44.220Z
Answers.UserDisplayName: hkymre
Answers.Body: <p>We just experienced this with the newest version October 2022 /54.
  In relation to smart groups and the search function. Also when exporting contacts. Is the patch from 2020 safe?</p>
  <p>'<em><strong>ERROR</strong></em>
  message:            DB Error: syntax error
  code:<br />
  exception:          PEAR_Exception Object
  (
  [cause:protected] =&gt; DB_Error Object
  (
  [error_message_prefix] =&gt;
  [mode] =&gt; 16
  [level] =&gt; 1024
  [code] =&gt; -2
  [message] =&gt; DB Error: syntax error
  [userinfo] =&gt; INSERT IGNORE INTO civicrm_tmp_e_gccache_1e5c7912afe5baa5f381309ac26f4b75 (group_id, contact_id) SELECT 486 AS group_id, contact_a.id as id  FROM civicrm_contact contact_a     WHERE  (  ( contact_a.created_date &gt;= '20191001000000' )  )  AND (contact_a.is_deleted = 0) AND contact_a.id NOT IN (
  SELECT contact_id FROM civicrm_group_contact
  WHERE civicrm_group_contact.status = 'Removed'
  AND civicrm_group_contact.group_id = 486 )   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';= '20191001000000' ) )  AND (contact_a.is_deleted = 0) AND contact_a.id NOT IN' at line 1]
  [backtrace] =&gt; Array
  (
  [0] =&gt; Array
  (
  [file] =&gt; /srv/www/html/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php
  [line] =&gt; 997
  [function] =&gt; __construct
  [class] =&gt; PEAR_Error
  [type] =&gt; -&gt;
  [args] =&gt; Array
  (
  [0] =&gt; DB Error: syntax error
  [1] =&gt; -2
  [2] =&gt; 16
  [3] =&gt; Array
  (
  [0] =&gt; CRM_Core_Error
  [1] =&gt; exceptionHandler
  )</p>
  <pre><code>                               [4] =&gt; INSERT IGNORE INT...
  </code></pre>
  <p><em><strong>LAST ERROR</strong></em>
  Array
  (
  [type] =&gt; 16384
  [message] =&gt; Calling the &quot;Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()&quot; method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.
  [file] =&gt; /srv/www/html/wordpress/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php
  [line] =&gt; 58
  )
  '</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-12T11:51:36.997Z
Answers.Text: My solution was - - - Mysql settings: more power 1GB
Answers.UserDisplayName: Mich___
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-10-12T09:18:30.563Z
Answers.LastActivityDate: 2022-10-12T09:18:30.563Z
Answers.UserDisplayName: Mich___
Body: <p>I'm testing out Civicrm. Started with Wordpress then copied the database into Drupal 7</p>
  
  <p>When trying to send a mailing to a group, the send test email issues </p>
  
  <p><strong>Error in call to Mailing_send_test : DB Error: syntax error</strong></p>
  
  <p>And trying to submit the mailing gives
  <strong>DB Error: syntax error</strong></p>
  
  <p>From the logs I can see</p>
  
  <pre><code> [code] =&gt; -2
  [message] =&gt; DB Error: syntax error
  [mode] =&gt; 16
  [debug_info] =&gt; INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
  [type] =&gt; DB_Error
  [user_info] =&gt; INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
  [to_string] =&gt; [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]"]
  </code></pre>
  
  <p>Edit - looks like this is the same issue as <a href="https://civicrm.stackexchange.com/questions/35868/smart-group-db-error">Smart Group DB error</a></p>
  
  <p>Answer given was - It has been reported here <a href="https://github.com/civicrm/civicrm-core/pull/17622" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/pull/17622</a> and it should be fixed by the CiviCRM 5.26.2.</p>
  
Tags: <drupal><mailing>
Title: Mailings - DB Error: syntax error
ThreadText: # Mailings - DB Error: syntax error
  
  (Asked by: username_0 on 2020-06-16)
  
  I'm testing out Civicrm. Started with Wordpress then copied the database into Drupal 7
  When trying to send a mailing to a group, the send test email issues 
  Error in call to Mailing_send_test : DB Error: syntax error
  And trying to submit the mailing gives
  DB Error: syntax error
  From the logs I can see
   [code] => -2
  [message] => DB Error: syntax error
  [mode] => 16
  [debug_info] => INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
  [type] => DB_Error
  [user_info] => INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
  [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="INSERT IGNORE INTO civicrm_tmp_e_gccache_e014dbed46046aa1c0657ac431a08f53 (group_id, contact_id)  [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]"]
  
  Edit - looks like this is the same issue as Smart Group DB error
  Answer given was - It has been reported here https://github.com/civicrm/civicrm-core/pull/17622 and it should be fixed by the CiviCRM 5.26.2.
  
  **Tags:** drupal, mailing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-06-16. Score: 2
  
  Tested the fix from <https://github.com/civicrm/civicrm-core/pull/17622> & can confirm it's now working as expected.
  
  > **Comments:**
  > **username_1**: We just started experiencing this error in 5.29.0, is anyone who previously had this issue experiencing a regression, or is there possibly a new error now? (we went from 5.25 to 5.27 so never experienced this previously)  
  
  ---
  
  ### Answer by username_2 on 2022-10-12. Score: 0
  
  We just experienced this with the newest version October 2022 /54.
  In relation to smart groups and the search function. Also when exporting contacts. Is the patch from 2020 safe?
  'ERROR
  message:            DB Error: syntax error
  code:
  exception:          PEAR_Exception Object
  (
  [cause:protected] => DB_Error Object
  (
  [error_message_prefix] =>
  [mode] => 16
  [level] => 1024
  [code] => -2
  [message] => DB Error: syntax error
  [userinfo] => INSERT IGNORE INTO civicrm_tmp_e_gccache_1e5c7912afe5baa5f381309ac26f4b75 (group_id, contact_id) SELECT 486 AS group_id, contact_a.id as id  FROM civicrm_contact contact_a     WHERE  (  ( contact_a.created_date >= '20191001000000' )  )  AND (contact_a.is_deleted = 0) AND contact_a.id NOT IN (
  SELECT contact_id FROM civicrm_group_contact
  WHERE civicrm_group_contact.status = 'Removed'
  AND civicrm_group_contact.group_id = 486 )   [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';= '20191001000000' ) )  AND (contact_a.is_deleted = 0) AND contact_a.id NOT IN' at line 1]
  [backtrace] => Array
  (
  [0] => Array
  (
  [file] => /srv/www/html/wordpress/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php
  [line] => 997
  [function] => __construct
  [class] => PEAR_Error
  [type] => ->
  [args] => Array
  (
  [0] => DB Error: syntax error
  [1] => -2
  [2] => 16
  [3] => Array
  (
  [0] => CRM_Core_Error
  [1] => exceptionHandler
  )
                                 [4] => INSERT IGNORE INT...
  
  LAST ERROR
  Array
  (
  [type] => 16384
  [message] => Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.
  [file] => /srv/www/html/wordpress/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php
  [line] => 58
  )
  '
  
  > **Comments:**
  > **username_2**: My solution was - - - Mysql settings: more power 1GB  
  
  ---
  
  