SQL function as non-privileged user