Thread: [GENERAL] Setting search_path ignored

[GENERAL] Setting search_path ignored

From
Guyren Howe
Date:

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.

Re: [GENERAL] Setting search_path ignored

From
"David G. Johnston"
Date:
On Mon, Oct 2, 2017 at 7:00 AM, Guyren Howe <guyren@gmail.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.


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

David J.

Re: [GENERAL] Setting search_path ignored

From
Guyren Howe
Date:
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.g.johnston@gmail.com>, wrote:
On Mon, Oct 2, 2017 at 7:00 AM, Guyren Howe <guyren@gmail.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.


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

David J.

Re: [GENERAL] Setting search_path ignored

From
"David G. Johnston"
Date:
On Mon, Oct 2, 2017 at 7:09 AM, Guyren Howe <guyren@gmail.com> wrote:
I logged out and back and did SET ROLE and got the same resullt.
 
Are you logging in as "thing_accessor" or some role that is a member of "thing_accessor"?

David J.

 

Re: [GENERAL] Setting search_path ignored

From
"Charles Clavadetscher"
Date:

Hello

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Guyren Howe
Sent: Montag, 2. Oktober 2017 16:10
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL General <pgsql-general@postgresql.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.g.johnston@gmail.com>, wrote:

On Mon, Oct 2, 2017 at 7:00 AM, Guyren Howe <guyren@gmail.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.

 

 

"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