Unqualified function calls break postgres_fdw compatibiliy
|Reported by:||fphilipe||Owned by:||robe|
I'm using postgres_fdw to access a database that has postgis installed. The problem is that the session that postgres_fdw opens only has pg_catalog in its search_path.
Let's call the DB being accessed by the foreign data wrapper (FDW) db1 and the DB hosting the FDW db2.
I have a view in db1 that calculates a distance between to geography points. In db2 I have a foreign table that reads from that view. Unfortunately the call to st_distance inside the FDW session fails because st_distance calls a private function _st_distance without explicitly specifying the schema.
Attached is a minimal script that reproduces this bug. Altering the function st_distance such that the schema postgis is installed in is in its search path fixes the problem. Unfortunately this is not always a feasible option.
PostgreSQL: PostgreSQL 9.4.0 on x86_64-apple-darwin14.0.0, compiled by Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn), 64-bit PostGIS: POSTGIS="2.1.5 r13152" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24" LIBXML="2.9.2" LIBJSON="UNKNOWN" RASTER