Filtering on an enum field in a foreign table
От | Vladimir Ryabtsev |
---|---|
Тема | Filtering on an enum field in a foreign table |
Дата | |
Msg-id | CAMqTPqnBnHSN2=wJhY=bNqp3=_xnaHJTVg9HOqP7t3=8QeKCRg@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Filtering on an enum field in a foreign table
|
Список | pgsql-performance |
I am querying a remote server through a foreign table definition.
I tried to cheat this thing by defining the enum fields as text in the foreign table but then the remote query fails with
ERROR: operator does not exist: public.product = text HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
This is ridiculous. Is there a way to workaround this and force it execute the remote query as is?
Regards,
Vlad
CREATE TABLE example (id integer, product product_enum, status status_enum)
Where
CREATE TYPE status AS ENUM ('active', 'testing', 'inactive', ...);
CREATE TYPE product AS ENUM ('a', 'b', 'c', ...);
I re-created enums on my server and created a foreign table as follows:
CREATE FOREIGN TABLE example (id integer, product product_enum, status status_enum)
SERVER remote;
When I am querying the foreign table on enum predicate like
select * from example where product = 'a' and status = 'active'
I see that filtering happens on my server which can be seen in the plan and can be felt from the query performance (indices are not used of course).
ERROR: operator does not exist: public.product = text HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
This is ridiculous. Is there a way to workaround this and force it execute the remote query as is?
Regards,
Vlad
В списке pgsql-performance по дате отправления: