Re: Setting search_path ignored

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: "'Guyren Howe'" <guyren(at)gmail(dot)com>, "'David G(dot) Johnston'" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "'PostgreSQL General'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Setting search_path ignored
Date: 2017-10-02 14:21:31
Message-ID: 02b901d33b89$d2acba90$78062fb0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Guyren Howe
Sent: Montag, 2. Oktober 2017 16:10
To: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Setting search_path ignored

I logged out and back and did SET ROLE and got the same resullt.

On Oct 2, 2017, 10:06 -0400, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com <mailto:david(dot)g(dot)johnston(at)gmail(dot)com> >, wrote:

On Mon, Oct 2, 2017 at 7:00 AM, Guyren Howe <guyren(at)gmail(dot)com <mailto:guyren(at)gmail(dot)com> > wrote:

CREATE ROLE thing_accessor;

CREATE ROLE

CREATE SCHEMA thing_accessor;

CREATE SCHEMA

covermything=> ALTER ROLE thing_accessor SET search_path=thing_accessor;

ALTER ROLE

covermything=# SET ROLE thing_accessor;

SET

covermything=> SHOW search_path;

search_path

-----------------

"$user", public

(1 row)

This seems to contradict all the advice I can find about setting the schema search path.

​Settings associated with roles only take affect at session start/login. SET ROLE does not cause them to be read/executed.

<https://www.postgresql.org/docs/9.6/static/config-setting.html> https://www.postgresql.org/docs/9.6/static/config-setting.html

"Values set with ALTER DATABASE and ALTER ROLE are applied only when starting a fresh database session."

David J.

search_path is not a privilege, but a property.

Properties are tight to the logged in user. With SET ROLE you become the role only for its privileges, not its properties.

Regards

Charles

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pinker 2017-10-02 15:22:29 Checkpoint write time - anything unusual?
Previous Message David G. Johnston 2017-10-02 14:16:32 Re: Setting search_path ignored