Error retrieving Scheduler list

When viewing the job logs of a scheduled task I get this message

Database failure. Please refer to suitecrm.log for details.

In the log I get this error message:

Sun Feb 26 17:04:01 2023 [816624][1][FATAL] Error retrieving Scheduler list:  Query Failed: (SELECT job_queue.id ,  job_queue.name ,  job_queue.status ,  job_queue.resolution ,  job_queue.execute_time ,  job_queue.date_modified ,  job_queue.assigned_user_id  ,  'times' panel_name  FROM job_queue  INNER JOIN  schedulers schedulers_times_rel ON job_queue.scheduler_id=schedulers_times_rel.id AND schedulers_times_rel.deleted=0

  where ( job_queue.scheduler_id='97596d3a-d1a1-d125-d565-63fb8d7341a2') AND job_queue.deleted=0) ORDER BY job_queue.execute_time desc LIMIT 0,10: MySQL error 1250: Table 'job_queue' from one of the SELECTs cannot be used in global ORDER clause
Sun Feb 26 17:04:01 2023 [816624][1][FATAL] [ListView::processUnionBeans] . Database failure. Please refer to suitecrm.log for details.

The formatted query is the following and what is unnecessary is the closing parenthesis AND job_queue.deleted = 0)

SELECT job_queue.id,
       job_queue.name,
       job_queue.status,
       job_queue.resolution,
       job_queue.execute_time,
       job_queue.date_modified,
       job_queue.assigned_user_id,
       'times' panel_name
FROM job_queue
         INNER JOIN schedulers schedulers_times_rel
                    ON job_queue.scheduler_id = schedulers_times_rel.id AND schedulers_times_rel.deleted = 0

where (job_queue.scheduler_id = '97596d3a-d1a1-d125-d565-63fb8d7341a2')
  AND job_queue.deleted = 0)
ORDER BY job_queue.execute_time desc
LIMIT 0,10;

If I remove the parentheses the query is working correctly. What could be the cause of this behavior?

Thanks in advance

This is a known issue and the fix is already on Github, though Iā€™m not sure if it is already released or not.

It would help if you included your SuiteCRM and MySQL versions in your post.

1 Like

Hi @pgr Thanks for answering

PHP 7.4.33
SUITERM 8.2.2

The curious thing for me is that in my local version of suitecrm it works fine. both local and remote copies are querying the same database

1 Like