I have a query that makes repeated use of the same snippet of code, which I'll call foo(), as if the function existed:
SELECT
foo(a),
BUILTIN(foo(a))
FROM
foobar
GROUP BY
foo(a)
HAVING
BUILTIN(foo(a)) > bar()
ORDER BY
foo(a)
;
Usually, I would have created this function foo long ago - what I actually see in my editor is the same messy nest of built-in functions several times.
However - I cannot CREATE my nice foo, as I only have USAGE permissions.
Does there exist a way for me to create some kind of 'alias', such that whenever I say foo, a longer function is executed; but this would of course not be available to any other DB user?
fooI wantbarto happen - but cruciallyfoois notcreated server-side, since I do not have permission to do so.pg_tempschema and it will disappear after the connection closes, but I couldn't tell you if you have access to that or not.foowith whatever and then run the query in any scripting language - that's not a flaw of anyone's security.