If you are using pgAdmin, there are two ways to invoke the debugger.
First, you can right-click on a function and choose "Debug" . When you use this method, pgAdmin will prompt you for values for any
INOUT parameters, set a breakpoint on the function you've chosen, and then invoke that function for you (using the parameter values that you've supplied). In this case, you must ensure that search_path is set before you start the debugger. You can set the
search_path for an entire database using the
ALTER DATABASE...SET command, or for a specific user with the
ALTER USER...SET command. Another option is to assign a value to
search_path for the function you want to debug; see the
ALTER FUNCTION...SET clause.
The other method is to right-click on a function name and choose "Set Breakpoint". When you use this method, the debugger will activate when any process invokes that function. Once you set a breakpoint, pgAdmin will pause, waiting for some other session to invoke the function in which you are interested. So start up another session, set the search_path as appropriate and then run your function. When the function starts, the debugger will activate in your pgAdmin session.
The nice thing about in-context debugging is that you can just run your application as normal and the debugger will activate whenever your application trips across the function, even if that function invocation is buried deep within some other function (or operator, or trigger, or ...)