Received: from flip.wildbrain.com ([206.54.55.32]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f5TJTma22944 for ; Fri, 29 Jun 2001 15:29:48 -0400 (EDT) (envelope-from dado@wildbrain.com) Received: from wildbrain.com (daedelus.wildbrain.com [192.168.1.38]) by flip.wildbrain.com (8.9.3/8.9.3) with ESMTP id MAA21486 for ; Fri, 29 Jun 2001 12:43:40 -0700 Message-ID: <3B3CD71D.D35F928@wildbrain.com> Date: Fri, 29 Jun 2001 12:29:33 -0700 From: Dado Feigenblatt X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2smp i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: creating variable views References: <200106291855.f5TItja06398@postgresql.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200106/473 X-Sequence-Number: 3776 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.