Re: Schemas, Roles & Search Path

From: Don Parris <parrisdc(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schemas, Roles & Search Path
Date: 2016-01-10 00:53:15
Message-ID: CAJ-7yomrR4t=CoOdBLErDXTW2Au7CbU+8GpUH3CvTboWOeuRqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 9, 2016 at 11:16 AM, Melvin Davidson <melvin6925(at)gmail(dot)com>
wrote:

> Just a side note. the search_path only sets the priority for resolving
> table locations
> EG: First look in COMMON, then FACILITIES until the table name is found.
>
> However, if you prefix the table name with the actual schema EG:
> COMMON.table, then the table is located directly and search_path is not
> needed.
>

Melvin, thanks for that - confirms what I understand about schemas.

>
> Finally, it is NOT a good idea to use UPPERCASE or CamelCase for object
> names in PostgreSQL, as PostgreSQL will naturally assume lowercase for all
> objects
> unless they are quoted. So probably you want schema names to be common,
> facilities, etc.
>
>
Thanks. I was just capitalizing for the e-mail. I never actually use
upper or camel case in my code.

> On Sat, Jan 9, 2016 at 10:22 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Don Parris <parrisdc(at)gmail(dot)com> writes:
>> > I *think* I want to set the search path on the group roles so that the
>> > Facilities team can see the COMMON and FACILITIES schemas:
>> > ALTER ROLE fm_users search_path=common, facilities, accounting;
>> >
>> > Or do I need to set the search path for each user individually?
>> > ALTER ROLE joe SET search_path=common, facilities, accounting;
>>
>> The latter. A session only absorbs ALTER ROLE SET settings for the
>> exact role you're logging in as. (Otherwise there would be a need
>> for a conflict resolution rule, and it's pretty hard to see how that
>> would work in general for arbitrary settings.) Role "inheritance"
>> applies to granted privileges only.
>>
>> regards, tom lane
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
>
> --
> *Melvin Davidson*
> I reserve the right to fantasize. Whether or not you
> wish to share my fantasy is entirely up to you.
>

--
D.C. Parris, FMP, Linux+, ESL Certificate
Minister, Security/FM Coordinator, Free Software Advocate
http://dcparris.net/ <https://www.xing.com/profile/Don_Parris>
<http://www.linkedin.com/in/dcparris>
GPG Key ID: F5E179BE

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Don Parris 2016-01-10 00:54:17 Re: Schemas, Roles & Search Path
Previous Message John R Pierce 2016-01-10 00:37:50 Re: New Slave - timeline ERROR