Re: Viewing another role's search path?

From: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Viewing another role's search path?
Date: 2013-07-29 15:12:31
Message-ID: CAB8KJ=gpZt2aTpcARfY25r_vRgqsARvSqbKRC71CmbwXH3wb7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2013/7/23 Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>:
> On 07/23/2013 05:15 AM, Ian Lawrence Barwick wrote:
>>
>> Is there some simple way of viewing the search path (or other
>> role-specific setting) for a role different to the current role? Apart
>> from
>> querying 'pg_db_role_setting' directly?
>>
>> Just wondering if I'm missing something obvious.
>
>
> http://www.postgresql.org/docs/9.2/interactive/app-psql.html
>
> \drds [ role-pattern [ database-pattern ] ]
> Lists defined configuration settings. These settings can be role-specific,
> database-specific, or both. role-pattern and database-pattern are used to
> select specific roles and databases to list, respectively. If omitted, or if
> * is specified, all settings are listed, including those not role-specific
> or database-specific, respectively.
>
> The ALTER ROLE and ALTER DATABASE commands are used to define per-role and
> per-database configuration settings.

Thanks, I missed that one. Unfortunately it produces a false negative if a
user hasn't had their search path explicitly set, e.g.:

postgres=# CREATE ROLE sp_test LOGIN;
CREATE ROLE
postgres=# \drds sp_test
No matching settings found.
postgres=# \c - sp_test
You are now connected to database "postgres" as user "sp_test".
postgres=> SHOW search_path ;
search_path
----------------
"$user",public
(1 row)

postgres=> \c - postgres
You are now connected to database "postgres" as user "postgres".
postgres=# ALTER ROLE sp_test SET search_path ="$user",public, foo;
ALTER ROLE
postgres=# \drds sp_test
List of settings
Role | Database | Settings
---------+----------+-----------------------------
sp_test | | search_path="$user", public, foo

Also it's psql-specific, so doesn't really lend itself as a global solution.

The custom view will have to do for now.

Regards

Ian Barwick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message bricklen 2013-07-29 15:20:35 Re: 5 is not a smallint but '5' is
Previous Message Tom Lane 2013-07-29 15:11:21 Re: Incorrect response code after XA recovery