Answers.Body: <p>Try changing the file <code>CRM/Mailing/BAO/Mailing.php</code> on <a href="https://github.com/civicrm/civicrm-core/blob/4.7.31/CRM/Mailing/BAO/Mailing.php#L336" rel="nofollow noreferrer">line 336</a> from:</p>
  
  <pre><code>      $query = $query-&gt;from('acl', $aclFrom);
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>      $query = $query-&gt;from('aclContactCache', $aclFrom);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-20T15:44:26.877Z
Answers.Text: Thanks for reply Jon. I change the code but no luck. Is the same error but different table. 'SELECT *
  FROM aclContactCache
  WHERE ( aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode=1146 ** Table 'pequo_civicrm.aclContactCache' doesn't exist]'
Answers.UserDisplayName: Jon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-20T16:43:25.813Z
Answers.Text: Hi Jon, I test  in the line the names of a tables civicrm_acl and civicrm_acl_cache and this step work but the next step in the field fails because use abbreviated name of table too and said missing field, it seems that the conversion from abbreviated name to real table name does not work. Any other idea??
Answers.UserDisplayName: Jon
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-20T13:31:18.897Z
Answers.LastActivityDate: 2019-09-20T13:31:18.897Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I have read other related questions but I do not see a match with my mistake.
  Civicrm version 4.7.31 Drupal 7.67 MySQL 5.6.42 PHP7.1
  After migrating from civicrm 4.5.8 and php5.6 everything works fine except for some things related to ACL permissions and smart groups the one that worries me most is that when I want to send an email with civimail, users have permission to see certain smart groups (the smart groups do not work correctly for me as well as in civicrm 4.5.8) and I select this group to send the mail to the recipients or they are empty or looking for them, if this way and everything I click on test mail I get the error: Error in call to Mailing_send_test: Error in call to MailingJob_create: DB Error: no such table
  I also have to say that if the smart group is the child of another, it does not appear in searches, nor in civimail, nor by default when listing in managing groups. If I put no parent then if it is displayed and let me select it to use it correctly but not when using it in civimail.</p>
  
  <pre><code>The error in the log is this:
  
  Sep 19 15:33:42 [info] $ Fatal Error Details = Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; exceptionHandler
          )
  
      [code] =&gt; -18
      [message] =&gt; DB Error: no such table
      [mode] =&gt; 16
      [debug_info] =&gt; INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist]
      [type] =&gt; DB_Error
      [user_info] =&gt; INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist]
      [to_string] =&gt; [db_error: message = "DB Error: no such table" code = -18 mode = callback callback = CRM_Core_Error :: exceptionHandler prefix = "" info = "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist] "]
  )
  
  
  #0 /public_html/sites/all/modules/civicrm/CRM/Core/Error.php(948): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /public_html/sites/all/modules/civicrm/packages/PEAR.php(921): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /public_html/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error-&gt;__construct("DB Error: no such table", -18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #3 /public_html/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error-&gt;__construct(-18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #4 /public_html/sites/all/modules/civicrm/packages/PEAR.php(223): PEAR-&gt;_raiseError(Object(DB_mysqli), NULL, -18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", "DB_Error", TRUE)
  #5 /public_html/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR-&gt;__call("raiseError", (Array:7))
  #6 /public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common-&gt;raiseError(-18, NULL, NULL, "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", "1146 ** Table 'pequo_civicrm.acl' doesn't exist")
  #7 /public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli-&gt;mysqliRaiseError()
  #8 /public_html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli-&gt;simpleQuery("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #9 /public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common-&gt;query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #10 /public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject-&gt;_query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #11 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(392): DB_DataObject-&gt;query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #12 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO-&gt;query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", TRUE)
  #13 /public_html/sites/all/modules/civicrm/CRM/Utils/SQL/Select.php(655): CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", (Array:0), TRUE, NULL, FALSE, TRUE, FALSE)
  #14 /public_html/sites/all/modules/civicrm/CRM/Mailing/BAO/Mailing.php(357): CRM_Utils_SQL_Select-&gt;execute()
  #15 /public_html/sites/all/modules/civicrm/CRM/Mailing/BAO/MailingJob.php(73): CRM_Mailing_BAO_Mailing::getRecipients("5580")
  #16 /public_html/sites/all/modules/civicrm/api/v3/utils.php(1288): CRM_Mailing_BAO_MailingJob::create((Array:12))
  #17 /public_html/sites/all/modules/civicrm/api/v3/MailingJob.php(44): _civicrm_api3_basic_create("CRM_Mailing_BAO_MailingJob", (Array:12))
  #18 /public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_mailing_job_create((Array:12))
  #19 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider-&gt;invoke((Array:9))
  #20 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel-&gt;runRequest((Array:9))
  #21 /public_html/sites/all/modules/civicrm/api/api.php(43): Civi\API\Kernel-&gt;runSafe("MailingJob", "create", (Array:12))
  #22 /public_html/sites/all/modules/civicrm/api/v3/Mailing.php(626): civicrm_api3("MailingJob", "create", (Array:12))
  #23 /public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_mailing_send_test((Array:10))
  #24 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider-&gt;invoke((Array:9))
  #25 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel-&gt;runRequest((Array:9))
  #26 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(77): Civi\API\Kernel-&gt;runSafe("mailing", "send_test", (Array:10), NULL)
  #27 /public_html/sites/all/modules/civicrm/Civi/API/Subscriber/ChainSubscriber.php(211): Civi\API\Kernel-&gt;run("mailing", "send_test", (Array:10))
  #28 /public_html/sites/all/modules/civicrm/Civi/API/Subscriber/ChainSubscriber.php(73): Civi\API\Subscriber\ChainSubscriber-&gt;callNestedApi(Object(Civi\API\Kernel), (Array:35), (Array:5), "create", "Mailing", 3)
  #29 [internal function](): Civi\API\Subscriber\ChainSubscriber-&gt;onApiRespond(Object(Civi\API\Event\RespondEvent), "civi.api.respond", Object(Civi\Core\CiviEventDispatcher))
  #30 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func((Array:2), Object(Civi\API\Event\RespondEvent), "civi.api.respond", Object(Civi\Core\CiviEventDispatcher))
  #31 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch((Array:4), "civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #32 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php(167): Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #33 /public_html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #34 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(276): Civi\Core\CiviEventDispatcher-&gt;dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #35 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(171): Civi\API\Kernel-&gt;respond(Object(Civi\API\Provider\MagicFunctionProvider), (Array:9), (Array:5))
  #36 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel-&gt;runRequest((Array:9))
  #37 /public_html/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel-&gt;runSafe("Mailing", "create", (Array:35), NULL)
  #38 /public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(311): civicrm_api("Mailing", "create", (Array:35))
  #39 /public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(548): CRM_Utils_REST::process((Array:3), (Array:35))
  #40 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(275): CRM_Utils_REST::ajax()
  #41 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:12))
  #42 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #43 /public_html/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:3))
  #44 /public_html/includes/menu.inc(527): civicrm_invoke("ajax", "rest")
  #45 /public_html/index.php(21): menu_execute_active_handler()
  #46 {main}
  </code></pre>
  
  <p>He says that the table is missing pequo_civicrm.acl I think the right thing would be for the table to be called so pequo_civicrm.civicrm_acl
  I have reviewed the civicrm_acl table with the backup before updating to 4.7.31 and it is exactly the same, with its primary keys and others the same or that seems.
  I have tried to recreate new user with new acl permissions, smart group and a whole test configuration and it also fails</p>
  
  <p>It is not a multilanguage site and I have searched for many days what could be the cause of this error and that I believe creates the other user errors + acl permissions + smart groups</p>
  
  <p><strong>UPDATE:I upgrade to 5.0 in dev installation without errors and no work too</strong><br>
  <strong>UPDATE 2: testing permissions in drupal if view contacts is assigned, override ACL permissions and work, but isn't the desired configuration, because show al information no designed and all groups</strong><br>
  <strong>LAST UPDATE:Testing in dev system and upgrading to 5.0.0 no work too, soo I update to 5.5.0 and works again</strong> </p>
  
  <p><strong>Thanks to all for your help</strong></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-19T14:52:20.573Z
Comments.Text: Do you have any custom code or extension that is implementing any civicrm acl hook?
Comments.UserDisplayName: Pradeep Nayak
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-19T15:03:23.607Z
Comments.Text: Thank for reply @PradeepNayak custom code no, extensions I don't know if they modify ACLs. my extensions are Show Contact Deceased,
  CiviCRM Export to Excel,
  Phone Number Validator,
  iATS Payments,
  RedSys Payment Processor,
  Prevent users from overwriting their record,
  CiviRules,
  E-mail API,
  Membership payemnt,
  List of nationalaties,
  Template attachments,
  Angular Profiles,
  CiviVolunteer,
  CiviBanking,
  Little BIC extension,
  Membership,
  SEPA Direct Debit,
  Capitalisation Corrector
Comments.UserDisplayName: Jon
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-09-20T17:48:32.873Z
Comments.Text: I I have disabled all extensions and there are no changes
Comments.UserDisplayName: Jon
Tags: <database><permissions><smartgroups><acl><user>
Title: SOLVED!! DB Error: no such table ERROR searching erroneous ACL table
ThreadText: # SOLVED!! DB Error: no such table ERROR searching erroneous ACL table
  
  (Asked by: username_0 on 2019-09-19)
  
  I have read other related questions but I do not see a match with my mistake.
  Civicrm version 4.7.31 Drupal 7.67 MySQL 5.6.42 PHP7.1
  After migrating from civicrm 4.5.8 and php5.6 everything works fine except for some things related to ACL permissions and smart groups the one that worries me most is that when I want to send an email with civimail, users have permission to see certain smart groups (the smart groups do not work correctly for me as well as in civicrm 4.5.8) and I select this group to send the mail to the recipients or they are empty or looking for them, if this way and everything I click on test mail I get the error: Error in call to Mailing\_send\_test: Error in call to MailingJob\_create: DB Error: no such table
  I also have to say that if the smart group is the child of another, it does not appear in searches, nor in civimail, nor by default when listing in managing groups. If I put no parent then if it is displayed and let me select it to use it correctly but not when using it in civimail.
  
  ```
  The error in the log is this:
  
  Sep 19 15:33:42 [info] $ Fatal Error Details = Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => exceptionHandler
          )
  
      [code] => -18
      [message] => DB Error: no such table
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist]
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist]
      [to_string] => [db_error: message = "DB Error: no such table" code = -18 mode = callback callback = CRM_Core_Error :: exceptionHandler prefix = "" info = "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)
  SELECT *
  FROM acl
  WHERE (aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)
   [nativecode = 1146 ** Table 'pequo_civicrm.acl' doesn't exist] "]
  )
  
  #0 /public_html/sites/all/modules/civicrm/CRM/Core/Error.php(948): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 /public_html/sites/all/modules/civicrm/packages/PEAR.php(921): CRM_Core_Error::exceptionHandler(Object(DB_Error))
  #2 /public_html/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such table", -18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #3 /public_html/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #4 /public_html/sites/all/modules/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -18, 16, (Array:2), "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", "DB_Error", TRUE)
  #5 /public_html/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
  #6 /public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-18, NULL, NULL, "INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", "1146 ** Table 'pequo_civicrm.acl' doesn't exist")
  #7 /public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
  #8 /public_html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #9 /public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #10 /public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1635): DB_DataObject->_query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #11 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(392): DB_DataObject->query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...")
  #12 /public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(1348): CRM_Core_DAO->query("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", TRUE)
  #13 /public_html/sites/all/modules/civicrm/CRM/Utils/SQL/Select.php(655): CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_recipients (mailing_id, contact_id, email_id)\nSE...", (Array:0), TRUE, NULL, FALSE, TRUE, FALSE)
  #14 /public_html/sites/all/modules/civicrm/CRM/Mailing/BAO/Mailing.php(357): CRM_Utils_SQL_Select->execute()
  #15 /public_html/sites/all/modules/civicrm/CRM/Mailing/BAO/MailingJob.php(73): CRM_Mailing_BAO_Mailing::getRecipients("5580")
  #16 /public_html/sites/all/modules/civicrm/api/v3/utils.php(1288): CRM_Mailing_BAO_MailingJob::create((Array:12))
  #17 /public_html/sites/all/modules/civicrm/api/v3/MailingJob.php(44): _civicrm_api3_basic_create("CRM_Mailing_BAO_MailingJob", (Array:12))
  #18 /public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_mailing_job_create((Array:12))
  #19 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
  #20 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:9))
  #21 /public_html/sites/all/modules/civicrm/api/api.php(43): Civi\API\Kernel->runSafe("MailingJob", "create", (Array:12))
  #22 /public_html/sites/all/modules/civicrm/api/v3/Mailing.php(626): civicrm_api3("MailingJob", "create", (Array:12))
  #23 /public_html/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_mailing_send_test((Array:10))
  #24 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9))
  #25 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:9))
  #26 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(77): Civi\API\Kernel->runSafe("mailing", "send_test", (Array:10), NULL)
  #27 /public_html/sites/all/modules/civicrm/Civi/API/Subscriber/ChainSubscriber.php(211): Civi\API\Kernel->run("mailing", "send_test", (Array:10))
  #28 /public_html/sites/all/modules/civicrm/Civi/API/Subscriber/ChainSubscriber.php(73): Civi\API\Subscriber\ChainSubscriber->callNestedApi(Object(Civi\API\Kernel), (Array:35), (Array:5), "create", "Mailing", 3)
  #29 [internal function](): Civi\API\Subscriber\ChainSubscriber->onApiRespond(Object(Civi\API\Event\RespondEvent), "civi.api.respond", Object(Civi\Core\CiviEventDispatcher))
  #30 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func((Array:2), Object(Civi\API\Event\RespondEvent), "civi.api.respond", Object(Civi\Core\CiviEventDispatcher))
  #31 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch((Array:4), "civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #32 /public_html/sites/all/modules/civicrm/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php(167): Symfony\Component\EventDispatcher\EventDispatcher->dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #33 /public_html/sites/all/modules/civicrm/Civi/Core/CiviEventDispatcher.php(47): Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #34 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(276): Civi\Core\CiviEventDispatcher->dispatch("civi.api.respond", Object(Civi\API\Event\RespondEvent))
  #35 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(171): Civi\API\Kernel->respond(Object(Civi\API\Provider\MagicFunctionProvider), (Array:9), (Array:5))
  #36 /public_html/sites/all/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:9))
  #37 /public_html/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->runSafe("Mailing", "create", (Array:35), NULL)
  #38 /public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(311): civicrm_api("Mailing", "create", (Array:35))
  #39 /public_html/sites/all/modules/civicrm/CRM/Utils/REST.php(548): CRM_Utils_REST::process((Array:3), (Array:35))
  #40 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(275): CRM_Utils_REST::ajax()
  #41 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:12))
  #42 /public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #43 /public_html/sites/all/modules/civicrm/drupal/civicrm.module(445): CRM_Core_Invoke::invoke((Array:3))
  #44 /public_html/includes/menu.inc(527): civicrm_invoke("ajax", "rest")
  #45 /public_html/index.php(21): menu_execute_active_handler()
  #46 {main}
  
  ```
  
  He says that the table is missing pequo\_civicrm.acl I think the right thing would be for the table to be called so pequo\_civicrm.civicrm\_acl
  I have reviewed the civicrm\_acl table with the backup before updating to 4.7.31 and it is exactly the same, with its primary keys and others the same or that seems.
  I have tried to recreate new user with new acl permissions, smart group and a whole test configuration and it also fails
  
  It is not a multilanguage site and I have searched for many days what could be the cause of this error and that I believe creates the other user errors + acl permissions + smart groups
  
  **UPDATE:I upgrade to 5.0 in dev installation without errors and no work too**  
  **UPDATE 2: testing permissions in drupal if view contacts is assigned, override ACL permissions and work, but isn't the desired configuration, because show al information no designed and all groups**  
  **LAST UPDATE:Testing in dev system and upgrading to 5.0.0 no work too, soo I update to 5.5.0 and works again**
  
  **Thanks to all for your help**
  
  **Tags:** database, permissions, smartgroups, acl, user
  
  > **Comments:**
  > **username_1**: Do you have any custom code or extension that is implementing any civicrm acl hook?  
  > **username_0**: Thank for reply @username_1 custom code no, extensions I don't know if they modify ACLs. my extensions are Show Contact Deceased, CiviCRM Export to Excel, Phone Number Validator, iATS Payments, RedSys Payment Processor, Prevent users from overwriting their record, CiviRules, E-mail API, Membership payemnt, List of nationalaties, Template attachments, Angular Profiles, CiviVolunteer, CiviBanking, Little BIC extension, Membership, SEPA Direct Debit, Capitalisation Corrector  
  > **username_0**: I I have disabled all extensions and there are no changes  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-09-20. Score: 0
  
  Try changing the file `CRM/Mailing/BAO/Mailing.php` on [line 336](https://github.com/civicrm/civicrm-core/blob/4.7.31/CRM/Mailing/BAO/Mailing.php#L336) from:
  
  ```
        $query = $query->from('acl', $aclFrom);
  
  ```
  
  to:
  
  ```
        $query = $query->from('aclContactCache', $aclFrom);
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for reply Jon. I change the code but no luck. Is the same error but different table. 'SELECT * FROM aclContactCache WHERE ( aclContactCache.user_id = 43137 AND contact_a.is_deleted = 0)  [nativecode=1146 ** Table 'pequo_civicrm.aclContactCache' doesn't exist]'  
  > **username_0**: Hi Jon, I test  in the line the names of a tables civicrm_acl and civicrm_acl_cache and this step work but the next step in the field fails because use abbreviated name of table too and said missing field, it seems that the conversion from abbreviated name to real table name does not work. Any other idea??  
  
  ---
  
  