Re: FDW error on remote view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Mauger <mmauger(at)protonmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: FDW error on remote view
Date: 2022-02-14 03:53:45
Message-ID: 2768412.1644810825@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Mauger <mmauger(at)protonmail(dot)com> writes:
> Why is there an error in the app context only when I invoke the view
> through a FOREIGN TABLE. And more importantly, how do I get around it?

It's hard to be sure with this amount of detail, but I think
what is happening is that your view invokes a plpgsql function
and that function is sensitive to the active search_path.
postgres_fdw runs the remote session with minimal search path
(i.e., search_path = 'pg_catalog'), so a function that tries
to reference something in 'public' is not gonna work unless
it provides an explicit schema-qualification or a function-local
setting of search_path.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dominique Devienne 2022-02-14 08:43:52 Re: "grant usage on schema" confers the ability to execute all user-defined functions in that schema, with needing to grant "execute"
Previous Message Michael Mauger 2022-02-14 03:10:38 FDW error on remote view