EXECUTE command denied for user


#1

Hello,
I am attempting to use a custom aggregate function but am running into errors with permissions. I have attempted to grant full access to my user via the root user but still no success. I’ve also tried creating as root and running as root - encountering the same error.

I am running 6.7.4.

I get the following error, after what seems like a normal amount of time for the query to complete:
Leaf Error (…:3307): EXECUTE command denied to user ‘…’@’%’ for function ‘X_terminate’

My aggregate is defined as:
DELIMITER //
CREATE AGGREGATE X_udaf(…) RETURNS DECIMAL
WITH STATE RECORD(…)
INITIALIZE WITH X_init
ITERATE WITH X_iter
MERGE WITH X_merge
TERMINATE WITH X_terminate;
//

The terminate is created like so:
DELIMITER //
CREATE FUNCTION X_terminate(state RECORD(…)) RETURNS DECIMAL AS
BEGIN RETURN 1;
END
//

I’ve tried many forms of: grant execute on mydb.* to ‘myuser’@’%’;
None seem to get me past this error. Any recommendations on how to proceed?
Thanks,
Josh


#2

Please follow below mentioned example.

create database sbtest;

use sbtest;

DELIMITER //
CREATE FUNCTION plus_one(a INT) RETURNS INT AS
DECLARE
b INT = a;
BEGIN
b += 1;
RETURN b;
END //
DELIMITER ;

CREATE USER myuser@’%’ IDENTIFIED BY ‘myuser’;

GRANT EXECUTE ON sbtest.plus_one TO ‘myuser’@’%’;

exit

memsql -umyuser -pmyuser

use sbtest;

select plus_one(1);

memsql> select plus_one(1);
±------------+
| plus_one(1) |
±------------+
| 2 |
±------------+
1 row in set (0.07 sec)


#3

Could we get the output of ‘show grants for …’ for both ‘root’ and ‘myuser’? Interested to see the output on both the agg and a leaf.

The 'Leaf Error…" chunk of the error message makes me think that perhaps the grants aren’t getting set correctly on the leaves.