Receive "Database failure. Please refer to suitecrm.log for details" #5044

Open
opened 2026-02-20 16:28:38 -05:00 by deekerman · 6 comments
Owner

Originally created by @jobst on GitHub (Jul 18, 2023).

general summary of the issue

I had a problem with 7.12.7, so I upgraded to 7.13.4, however the problem persists.

When I select ONE account below Accounts the subpanels for "Contacts", " Opportunities" and " Leads" will show "Database failure. Please refer to suitecrm.log for details"

Looking at the log (even with turned UP logging) I cannot see the reason why this might be the case.

does a similar issue already exists

Done that, have not seen anything but might be searching incorrectly

However I found someone complaining about it

https://community.suitecrm.com/t/database-failure-please-refer-to-suitecrm-log-for-details/69757

I did what [@chirag_biz309] suggested and that fixed my problem.

discovered a security risk

Nope.

7.10.x.?

NO.

still applicable in 7.12.x?

It was for 7.12.7, but also visible in 7.13.4

Issue

Expected Behavior

I should NOT see "Database failure. Please refer to suitecrm.log for details" when I select ONE account of Accounts or ONE contact of Contacts in the subpanels (e.g. contacts, opportunities, leads".
Same is valid for Contacts.

Actual Behavior

When I click on "Accounts" OR "Contacts", then selects ONE account or contact respectively I get "Database failure. Please refer to suitecrm.log for details" for the SUB PANELS (e..g for Accounts -> Contacts, Opportunities, Leads)

Possible Fix

I searched various places, there were a number of answers, one of which was

    https://community.suitecrm.com/t/database-failure-please-refer-to-suitecrm-log-for-details/69757

I did what [@chirag_biz309] suggested and that fixed my problem.

There are actually TWO ISSUES in the same file with the same SINGLE QUOTES that should not be there.
Line numbers 875 and 930

One of the fixes in file PATH_TO_SUITECRM/data/SugarBean.php is at line number 875:

  // change from this
  // $final_query = '(' . $tmp_final_query . ')';
  // to this
  $final_query = $tmp_final_query;

and the other one at 930 (same coding thing)

  // from this                                                                                                                                                                                                                                    
  // $query = '(' . $query . ')';                                                                                                                                                                                                                 
  // to this                                                                                                                                                                                                                                      
  $query = $query;

Basically just taking out the '(' and ')' - it will work correctly after this.

What I think has happend someone in a hurry copied the CORRECT (in this case because of the union) code from above

 $final_query .= ' UNION ALL ( ' . $tmp_final_query . ' )';

and placed it below into the "} else {"

 if (!$first) {                                                                                                                                                                                                                                      
   $final_query_rows .= ' UNION ALL ( ' . $parentbean->create_list_count_query($tmp_final_query, $parameters) . ' )';
   $final_query .= ' UNION ALL ( ' . $tmp_final_query . ' )';
 } else {
   $final_query_rows = '(' . $parentbean->create_list_count_query($tmp_final_query, $parameters) . ')';
   // THIS IS WRONG!!!
   // $final_query = '(' . $tmp_final_query . ')';
   // it should be 
   $final_query = $tmp_final_query;
   $first = false;
 }

Steps to Reproduce

  1. Click on Accounts (or Contacts)
  2. select ONE of the accounts or contacts displayed (anyone will do)
  3. below each subpanel I get a message "Database failure. Please refer to suitecrm.log for details"
  4. subpanels are otherwise empty

Context

What is surprising to me that no-one else complains about this?
Or do I really have a unique environment that it only affects me?

Your Environment

  • SuiteCRM Version used: 7.12.7 and 7.13.4
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): NOT APPLICABLE
  • Environment name and version (e.g. MySQL, PHP 7): 7.4.33 (about to upgrade, havent had the time)
  • Operating System and version (e.g Ubuntu 16.04): Alma Linux 8.8
Originally created by @jobst on GitHub (Jul 18, 2023). <!--- Provide a general summary of the issue in the **Title** above --> ### general summary of the issue I had a problem with 7.12.7, so I upgraded to 7.13.4, however the problem persists. When I select ONE account below Accounts the subpanels for "Contacts", " Opportunities" and " Leads" will show "Database failure. Please refer to suitecrm.log for details" Looking at the log (even with turned UP logging) I cannot see the reason why this might be the case. <!--- Before you open an issue, please check if a similar issue already exists or has been closed before. ---> ### does a similar issue already exists Done that, have not seen anything but might be searching incorrectly However I found someone complaining about it ``` https://community.suitecrm.com/t/database-failure-please-refer-to-suitecrm-log-for-details/69757 ``` I did what [@chirag_biz309] suggested and that fixed my problem. <!--- If you have discovered a security risk please report it by emailing security@suitecrm.com. This will be delivered to the product team who handle security issues. Please don't disclose security bugs publicly until they have been handled by the security team. ---> ### discovered a security risk Nope. <!--- Please be aware that as of the 31st January 2022 we no longer support 7.10.x. New issues referring to 7.10.x will only be valid if applicable to 7.12.x and above. --> ### 7.10.x.? NO. <!-- If your issue is still applicable in 7.12.x, please create the issue following the template below --> ### still applicable in 7.12.x? It was for 7.12.7, but also visible in 7.13.4 ### Issue <!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug --> <!--- Ensure that all code ``` is surrounded ``` by triple back quotes. This can also be done over multiple lines --> #### Expected Behavior <!--- Tell us what should happen --> I should NOT see "Database failure. Please refer to suitecrm.log for details" when I select ONE account of Accounts or ONE contact of Contacts in the subpanels (e.g. contacts, opportunities, leads". Same is valid for Contacts. #### Actual Behavior <!--- Tell us what happens instead --> <!--- Also please check relevant logs (suitecrm.log, php error.log etc.) --> When I click on "Accounts" OR "Contacts", then selects ONE account or contact respectively I get "Database failure. Please refer to suitecrm.log for details" for the SUB PANELS (e..g for Accounts -> Contacts, Opportunities, Leads) ### Possible Fix <!--- Not obligatory, but suggest a fix or reason for the bug --> I searched various places, there were a number of answers, one of which was ``` https://community.suitecrm.com/t/database-failure-please-refer-to-suitecrm-log-for-details/69757 ``` I did what [@chirag_biz309] suggested and that fixed my problem. There are actually TWO ISSUES in the same file with the same SINGLE QUOTES that should not be there. Line numbers 875 and 930 One of the fixes in file PATH_TO_SUITECRM/data/SugarBean.php is at line number 875: ``` // change from this // $final_query = '(' . $tmp_final_query . ')'; // to this $final_query = $tmp_final_query; ``` and the other one at 930 (same coding thing) ``` // from this // $query = '(' . $query . ')'; // to this $query = $query; ``` Basically just taking out the '(' and ')' - it will work correctly after this. What I think has happend someone in a hurry copied the CORRECT (in this case because of the union) code from above ``` $final_query .= ' UNION ALL ( ' . $tmp_final_query . ' )'; ``` and placed it below into the "} else {" ``` if (!$first) { $final_query_rows .= ' UNION ALL ( ' . $parentbean->create_list_count_query($tmp_final_query, $parameters) . ' )'; $final_query .= ' UNION ALL ( ' . $tmp_final_query . ' )'; } else { $final_query_rows = '(' . $parentbean->create_list_count_query($tmp_final_query, $parameters) . ')'; // THIS IS WRONG!!! // $final_query = '(' . $tmp_final_query . ')'; // it should be $final_query = $tmp_final_query; $first = false; } ``` ### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Click on Accounts (or Contacts) 2. select ONE of the accounts or contacts displayed (anyone will do) 3. below each subpanel I get a message "Database failure. Please refer to suitecrm.log for details" 4. subpanels are otherwise empty ### Context <!--- How has this bug affected you? What were you trying to accomplish? --> <!--- If you feel this should be a low/medium/high priority then please state so --> What is surprising to me that no-one else complains about this? Or do I really have a unique environment that it only affects me? ### Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * SuiteCRM Version used: 7.12.7 and 7.13.4 * Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): NOT APPLICABLE * Environment name and version (e.g. MySQL, PHP 7): 7.4.33 (about to upgrade, havent had the time) * Operating System and version (e.g Ubuntu 16.04): Alma Linux 8.8
Author
Owner

@jobst commented on GitHub (Jul 18, 2023):

Just saw another entry at

https://community.suitecrm.com/t/contact-database-failure-please-refer-to-suitecrm-log-for-details/87401

Same issue, same solution.
Again I am surprised not more people have this problem ...

@jobst commented on GitHub (Jul 18, 2023): Just saw another entry at ``` https://community.suitecrm.com/t/contact-database-failure-please-refer-to-suitecrm-log-for-details/87401 ``` Same issue, same solution. Again I am surprised not more people have this problem ...
Author
Owner

@chris001 commented on GitHub (Jul 19, 2023):

@jobst Can you make a PR for this issue, with your code fix?

@chris001 commented on GitHub (Jul 19, 2023): @jobst Can you make a PR for this issue, with your code fix?
Author
Owner

@jobst commented on GitHub (Jul 20, 2023):

@chris001 I have not done a pull request for a while....
I put everything in but it tells me "I must be a collaborator" and fails to create the pull request.

@jobst commented on GitHub (Jul 20, 2023): @chris001 I have not done a pull request for a while.... I put everything in but it tells me "I must be a collaborator" and fails to create the pull request.
Author
Owner

@chris001 commented on GitHub (Jul 20, 2023):

@jobst about that error "must be a collaborator"...

The one special privilege a collaborator has over a contributor is... that they (the collaborator) can push directly to this repository (since the repo owner SalesAgility would have added you as "collaborator").

A collaborator can push their own branch (inside this repo) and do a pull request from within this repo, between their branch (in this repo) and master.

As opposed to a contributor (this is you! and me), who has to fork this repository first, and make a pull request from your own fork/branch to this repo, the hotfix branch.

@chris001 commented on GitHub (Jul 20, 2023): @jobst about that error "must be a collaborator"... The one special privilege a **collaborator** has over a **contributor** is... that they (the collaborator) can push directly to this repository (since the repo owner SalesAgility would have [added you as "collaborator"](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository)). A collaborator can push their own branch (inside this repo) and do a pull request from within this repo, between their branch (in this repo) and master. As opposed to a **contributor** (this is you! and me), [who has to fork this repository first](https://help.github.com/en/github/getting-started-with-github/fork-a-repo), and make a pull request from your own fork/branch to this repo, the `hotfix` branch.
Author
Owner

@johnM2401 commented on GitHub (Jul 21, 2023):

Hey Folks
Thanks for getting in touch!

Could you share which MySQL version you are using, @jobst ?

I believe this issue might be MySQL8-specific, but It would be good to gather more information.


There is another ticket on this repo with similar, (if not the same), issue where the user is using MySQL8:
https://github.com/salesagility/SuiteCRM/issues/9788
(In which users discuss the same fix as you have above)

If so, looks like there may already be an appropriate PR:
https://github.com/salesagility/SuiteCRM/pull/9843

(Though, if this is not the same issue, please let us know!)

Thanks!

@johnM2401 commented on GitHub (Jul 21, 2023): Hey Folks Thanks for getting in touch! Could you share which MySQL version you are using, @jobst ? I believe this issue might be MySQL8-specific, but It would be good to gather more information. <br> There is another ticket on this repo with similar, (if not the same), issue where the user is using MySQL8: https://github.com/salesagility/SuiteCRM/issues/9788 (In which users discuss the same fix as you have above) If so, looks like there may already be an appropriate PR: https://github.com/salesagility/SuiteCRM/pull/9843 (Though, if this is not the same issue, please let us know!) Thanks!
Author
Owner

@serhiisamko091184 commented on GitHub (Oct 7, 2024):

Hello @jobst,

The issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs.
Thanks for your contributions.

Regards,
Serhii

@serhiisamko091184 commented on GitHub (Oct 7, 2024): Hello @jobst, The issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs. Thanks for your contributions. Regards, Serhii
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5044
No description provided.