"Type does not exist" error when returning array of type in non-public schema

Поиск
Список
Период
Сортировка
От Chris Cleveland
Тема "Type does not exist" error when returning array of type in non-public schema
Дата
Msg-id CABSN6VeVYOEQ440umD0OgQRV9SAT4uUMkXWB-n-PScA9kkt7fw@mail.gmail.com
обсуждение исходный текст
Ответы Re: "Type does not exist" error when returning array of type in non-public schema
Re: "Type does not exist" error when returning array of type in non-public schema
Список pgsql-hackers

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?


--
Chris Cleveland
312-339-2677 mobile

В списке pgsql-hackers по дате отправления: