X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 41165921B83 for ; Fri, 30 May 2003 15:31:47 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 88927-05 for ; Fri, 30 May 2003 15:31:39 -0400 (EDT) Received: from ns3.biznetindia.com (unknown [203.200.89.83]) by developer.postgresql.org (Postfix) with ESMTP id C5BBA925D10 for ; Fri, 30 May 2003 15:31:36 -0400 (EDT) Received: from mail.linux-delhi.org ([203.122.36.67]) by ns3.biznetindia.com (8.12.8/8.12.5) with ESMTP id h4UJVOqW029823 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Sat, 31 May 2003 01:01:31 +0530 Received: from mail.linux-delhi.org (localhost [127.0.0.1]) by mail.linux-delhi.org (8.12.8/8.12.5) with ESMTP id h4UJVN4O032267 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 31 May 2003 01:01:23 +0530 Received: (from raju@localhost) by mail.linux-delhi.org (8.12.8/8.12.8/Submit) id h4UJVLDA032263; Sat, 31 May 2003 01:01:21 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16087.45449.309496.281238@mail.linux-delhi.org> Date: Sat, 31 May 2003 01:01:21 +0530 To: pgsql-sql@postgresql.org Subject: Dynamic views/permissions X-Mailer: VM 7.07 under 21.4 (patch 8) "Honest Recruiter" XEmacs Lucid From: Raj Mathur X-Spam-Status: No, hits=0.8 required=9.5 tests=SPAM_PHRASE_00_01 version=2.43 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/579 X-Sequence-Number: 13744 I'm trying to permit users access to their own records in a database. A sample would be: create table logins ( login char(8), name char(32), primary key (login) ); When a login is added an SQL user is created simultaneously. Now I want the user to be able to view her own data: create function userid() returns text as 'select current_user::text;' language sql; create view loginview as select * from logins where logins.login=userid(); grant select on loginview to public; [OR grant select on loginview to ...] However, a select * from loginview; doesn't return any rows. Is what I'm trying not possible at all, or am I just trying to implement it wrong? Regards, -- Raju -- Raj Mathur raju@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F It is the mind that moves