Re: View definition and schema search path bug or expected behaviour?

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Chris Bartlett <c(dot)bartlett(at)paradise(dot)net(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: View definition and schema search path bug or expected behaviour?
Date: 2012-07-26 02:51:30
Message-ID: 5010B0B2.50302@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/25/2012 07:47 PM, Chris Bartlett wrote:
> At 7:37 PM -0700 25/7/12, Adrian Klaver wrote:
>> I am guessing if you do show search_path; from psql you will see that
>> the public schema is before the bob schema. The SELECT for the
>> unqualified people table in CREATE VIEW bob.people_view will find
>> public.people first in that case.
>
> I don't think that's it:
>
> show search_path
> -> "$user",public
>
> select SESSION_USER
> -> bob
>
> From the docs:
> "The value for search_path must be a comma-separated list of schema
> names. If one of the list items is the special value $user, then the
> schema having the name returned by SESSION_USER is substituted, if there
> is such a schema. (If not, $user is ignored.)"

I see your point, but see below.

http://www.postgresql.org/docs/9.2/static/runtime-config-client.html
"
If one of the list items is the special name $user, then the schema
having the name returned by SESSION_USER is substituted, if there is
such a schema and the user has USAGE permission for it. (If not, $user
is ignored.)"

In this version there is the qualifier that the user must have USAGE
privileges on the schema. Is that the case?

\dn+ should confirm.

>
> Also:
> select * from people
> -> returns records from bob.people
>
>

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Bartlett 2012-07-26 03:19:02 Re: View definition and schema search path bug or expected behaviour?
Previous Message Chris Bartlett 2012-07-26 02:47:29 Re: View definition and schema search path bug or expected behaviour?