creating variable views

From: Dado Feigenblatt <dado(at)wildbrain(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: creating variable views
Date: 2001-06-29 19:29:33
Message-ID: 3B3CD71D.D35F928@wildbrain.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)wildbrain(dot)com San Francisco, CA.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Sawtell 2001-06-30 04:14:49 Re: day difference
Previous Message --CELKO-- 2001-06-29 19:06:28 Re: Help!!! Trying to "SELECT" and get a tree structure back.