creating variable views - Mailing list pgsql-sql

From Dado Feigenblatt
Subject creating variable views
Date
Msg-id 3B3CD71D.D35F928@wildbrain.com
Whole thread Raw
List pgsql-sql
Hi. New to the list.

I'm building a database that will hold data for many different projects.
Some people, or groups of people, will have access to just the rows of data of their
projects.
Some are very granular. Let's use for this example the data about the people itself.
Other than the administrators, I want people to see only their own data.
Instead of creating a view for each person, is it possible to create a single view with
variable data?

CREATE VIEW user_info AS
SELECT * FROM users
WHERE user_name = pg_user

where pg_user is the user name that person used to log into the database.
Is there a way to get the user name in Postgresql?
Even if the variable pg_user is not available,
is it possible to create views using variables like that?

Thanks.

--
Dado Feigenblatt                                 Wild Brain, Inc.
Technical Director                               (415) 553-8000 x???
dado@wildbrain.com                               San Francisco, CA.





pgsql-sql by date:

Previous
From: Craig Longman
Date:
Subject: create datatype
Next
From: Christopher Sawtell
Date:
Subject: Re: day difference