非互換
postgres_fdwを利用した外部テーブルにアクセスする際に、オブジェクト識別子データ型を含むクエリーを実行すると、実行計画が変更される場合があります。
postgres=# CREATE TEXT SEARCH CONFIGURATION public.custom_search (COPY = pg_catalog.english);
postgres=# EXPLAIN (VERBOSE, COSTS OFF)
postgres-# SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM pg_fdw_tbl
postgres-# WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0;
QUERY PLAN
-------------------------------------------------------------------------
Foreign Scan on public.pg_fdw_tbl
Output: c1, to_tsvector('custom_search'::regconfig, c3)
Filter: (length(to_tsvector('custom_search'::regconfig, pg_fdw_tbl.c3)) > 0)
Remote SQL: SELECT "C 1", c3 FROM "S 1"."T 1" WHERE (("C 1" = 642))
(4 rows)postgres=# EXPLAIN (VERBOSE, COSTS OFF)
postgres-# SELECT c1, to_tsvector('custom_search'::regconfig, c3) FROM pg_fdw_tbl
postgres-# WHERE c1 = 642 AND length(to_tsvector('custom_search'::regconfig, c3)) > 0;
QUERY PLAN
-------------------------------------------------------------------------
Foreign Scan on public.pg_fdw_tbl
Output: c1, to_tsvector('custom_search'::regconfig, c3)
Remote SQL: SELECT "C 1", c3 FROM "S 1"."T 1" WHERE (("C 1" = 642)) AND ((length(to_tsvector('public.custom_search'::regconfig, c3)) > 0))
(3 rows)対処方法
ALTER EXTENSION ... ADDコマンドを使用して、postgres_fdwにオブジェクトを追加してください。