Search code examples
mysqlsqlyog

Export MySQL all databases with SQLyog produces invoker / definer rights error


We have a job that exports all database (including mysql) using SQLyog and this job runs nightly. Recently, we added a view that uses a function:

SELECT
     ps.SubmissionDate SubmissionDate,
     ps.TransactionNo,
     ps.FormNumber
FROM
     premier_submissions ps
UNION
SELECT
     psh.LastSubmissionDate SubmissionDate,
     psh.TransactionNo,
     psh.FormNumber
FROM
     premier_submissionhistory psh
UNION
SELECT
     SPLIT_STR (ps.SubmissionDates, '*', 1) SubmissionDate,
     ps.TransactionNo,
     ps.FormNumber
FROM
     premier_submissions ps
UNION
SELECT
     SPLIT_STR (psh.ResubmissionDates, '*', 1) SubmissionDate,
     psh.TransactionNo,
     psh.FormNumber
FROM
     premier_submissionhistory psh

Now when this export job runs, we get this error:

"View 'pride.charges_by_submission_date' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them"

The function SPLIT_STR is not new and exports just fine. What's even more strange, is I can create a job that just exports this view and the function, and that works fine. The job only fails if I export everything and that is consistent - error occurs every time. Yes, I've checked permissions for the account that is doing the backup. I posted in SQLyog forums, and got no response.


Solution

  • The problem was that the user had SELECT privilege, which allowed exporting the function the table, but did not have EXECUTE privilege, which apparently is required to export a view that uses a function.