The documentation for MySQL isn't explicit on this point, but I'm wondering whether the scope for a function with respect to DETERMINISTIC is database global, or by some other scope?
Consider this definition:
CREATE
FUNCTION test()
RETURNS VARCHAR(255) DETERMINISTIC
RETURN USER();
This function is determinstic for all calls in the same connection, as user()
will always return the same value. However, does DETERMINISTIC
mean that "computed" values are shared across connections?
Defensively I would treat this function as NOT DETERMINISTIC
but the question came up and I'm curious about the answer.