Bug fix. Wrong permission checks for creating stored function.
CREATE OR REPLACE permission check tests.

Contains an MTR error. In review.