X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2BE043A5B09 for ; Wed, 26 Jan 2005 08:55:48 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 88908-04 for ; Wed, 26 Jan 2005 08:55:45 +0000 (GMT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id 8D1E53A5B05 for ; Wed, 26 Jan 2005 08:55:46 +0000 (GMT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-31.mail.demon.net with esmtp (Exim 4.42) id 1Ctiwd-0006ai-5z; Wed, 26 Jan 2005 08:54:36 +0000 Received: from [192.168.1.17] (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id DC156178E4; Wed, 26 Jan 2005 08:55:43 +0000 (GMT) Message-ID: <41F75B0F.6030504@archonet.com> Date: Wed, 26 Jan 2005 08:55:43 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Din Adrian Cc: pgsql-sql@postgresql.org Subject: Re: private table References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.072 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200501/249 X-Sequence-Number: 20037 Din Adrian wrote: > Hello, > I am want to use a private table in postgresql(every client to see his > own data). > Is this possible? How can I do it! If I understand what you want, then this is traditionally done using views. CREATE TABLE base_table ( a integer NOT NULL, b text, u name, PRIMARY KEY (a) ); CREATE VIEW my_rows AS SELECT a,b FROM base_table WHERE u = CURRENT_USER; Add rules so that updating my_rows updates base_table instead. Then, revoke access on base_table (apart from your super-user) but grant it on my_rows. As far as a user is concerned "my_rows" just contains their rows and if they log in as a different user they will see different data. -- Richard Huxton Archonet Ltd