Re: views to behave differently according to user and schema - Mailing list pgsql-general

From Richard Huxton
Subject Re: views to behave differently according to user and schema
Date
Msg-id 42F0AFA9.4000202@archonet.com
Whole thread Raw
In response to views to behave differently according to user and schema  (Samuel Thoraval <samuel.thoraval@librophyt.com>)
List pgsql-general
Samuel Thoraval wrote:
>
> Is it possible to change this behavior so that the VIEW will dynamically
> use the search_path variable (when the schema was not specifically set) ?
> In this case, when user nsp2 loggs in, the VIEW vtest would be using
> VIEW nsp2.test, when user nsp3 loggs in it would use VIEW nsp3.test, for
> user nsp1 TABLE nsp1.test ...

I don't think so. There's no guarantee that nsp1 and nsp2 have the same
definition, which means the view could break depending on search_path.

You could create a separate view in each schema of course.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Vahe Ghorghorian"
Date:
Subject: Hello
Next
From: Richard Huxton
Date:
Subject: Re: Hello