Re: dblink: give search_path

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: dblink: give search_path
Date: 2018-04-11 13:24:24
Message-ID: a42ac116-97b7-1cbd-68a5-ffc9b748fc37@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 04/10/2018 11:44 PM, Thiemo Kellner wrote:
> Hi all
>
> I try to execute a function not in the Schema I connect to with dblink.
> Is there way to tell dblink to set search_path in a specific way? I have
> not found a solution in the documentation. I tried with the set
> search_path definition in the function declarations to no avail.

https://www.postgresql.org/docs/10/static/contrib-dblink-connect.html

"
Notes

If untrusted users have access to a database that has not adopted a
secure schema usage pattern, begin each session by removing
publicly-writable schemas from search_path. One could, for example, add
options=-csearch_path= to connstr. This consideration is not specific to
dblink; it applies to every interface for executing arbitrary SQL commands.
"

or schema qualify the function:

select logger.some_func();

>
> Function Schema: logger
> Database: act
> User: act
> User Default Schema: act
>
> Kind regards
>
> Thiemo
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message camarillo 2018-04-11 13:53:00 pg_basebackup restore a single table
Previous Message Alexandre Arruda 2018-04-11 12:49:40 Re: ERROR: found multixact from before relminmxid