2

I have an issue where I am unable to make a cross-schema function call because of that function's use of PostGIS. I have both PostGIS and my function in the public schema, but I'm trying to call the function from my ORM which, by necessity, is pointed at another schema. I am able to reference the function by using SELECT * FROM public.functionName, but the function execution fails when it reaches PostGIS-relevant functions like ST_MakeLine. What is the best solution in this case, move PostGIS and my function out of public? Edit the function itself to call public.PostGISFunction? Something else entirely?

Vince
  • 20,017
  • 15
  • 45
  • 64
Fell
  • 115
  • 5

1 Answers1

1

The issue is with the search path. As suggested by @JohnPowell, you would need to make sure the user has public in its search path.

Alternatively, you could use add a configuration at the function level to add public to the search path of the function:

CREATE OR REPLACE FUNCTION public.mysuperfunction() RETURNS integer AS
$BODY$BEGIN

  RETURN 1;
END;$BODY$ LANGUAGE plpgsql
    -- Set path as Postgis needs public but user doesn't have access
    SET search_path = public;
JGH
  • 41,794
  • 3
  • 43
  • 89