From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Mauger <mmauger@protonmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: FDW error on remote view
Date: Sun, 13 Feb 2022 22:53:45 -0500
Message-ID: <2768412.1644810825@sss.pgh.pa.us> (raw)
In-Reply-To: <pThtLzmXu5kojcHMpyrmR0Q_ohXEMKxSzjeoO1jl88KA4nCZFnZz175HHrqxWl3qWWZftVshZs-LlUSi9nXfcomfjsvoUNgGsCF2nvhbez8=@protonmail.com>
References: <pThtLzmXu5kojcHMpyrmR0Q_ohXEMKxSzjeoO1jl88KA4nCZFnZz175HHrqxWl3qWWZftVshZs-LlUSi9nXfcomfjsvoUNgGsCF2nvhbez8=@protonmail.com>
Michael Mauger <mmauger@protonmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, mmauger@protonmail.com
Subject: Re: FDW error on remote view
In-Reply-To: <2768412.1644810825@sss.pgh.pa.us>
References: <pThtLzmXu5kojcHMpyrmR0Q_ohXEMKxSzjeoO1jl88KA4nCZFnZz175HHrqxWl3qWWZftVshZs-LlUSi9nXfcomfjsvoUNgGsCF2nvhbez8=@protonmail.com> <2768412.1644810825@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox