I'm developing a Postgres extension that gets installed in its own schema, "rdb
". It creates its own type, "token
", and has a function that returns an array of that type. When I SELECT the function in psql, I get an ERROR: type "token" does not exist
It's a search_path problem. If I call SET search_path TO "$user", public, rdb;
everything works fine.
The trouble is that I can't expect those who install the extension to type that command, nor do I wish to ALTER DATABASE SET search_path=...
to change the global search path, because that might cause problems in an unknown environment. (It's already done strange things to my environment).
Oddly, when the function returns just the type itself, not an array of them, it works fine. In other words, this works:
CREATE FUNCTION my_func ... RETURNS Token ...
but this fails:
CREATE FUNCTION my_func ... RETURNS Token[] ...
No amount of fiddling with the syntax seems to help. RETURN rdb.Token[]
, RETURN "rdb.Token"[]
, RETURN "rdb.Token[]"
all fail.
This problem is happening in pg17. Haven't tried other versions.
Is there a solution here?