Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id E00C17E4440 for ; Fri, 22 Jun 2012 08:36:26 -0300 (ADT) Received: from mailout-de.gmx.net ([213.165.64.22]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Si2A5-0008Hz-3f for pgsql-sql@postgresql.org; Fri, 22 Jun 2012 11:36:26 +0000 Received: (qmail invoked by alias); 22 Jun 2012 11:36:11 -0000 Received: from mue-88-130-23-179.dsl.tropolys.de (EHLO [192.168.1.113]) [88.130.23.179] by mail.gmx.net (mp040) with SMTP; 22 Jun 2012 13:36:11 +0200 X-Authenticated: #14269776 X-Provags-ID: V01U2FsdGVkX18TRABoxmwToGhKy7pJ402MTssmbXlHjptCYbmDVV V2yZNGEuYIro2R Message-ID: <4FE458AB.4000109@gmx.net> Date: Fri, 22 Jun 2012 13:36:11 +0200 From: Andreas User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: How to limit access only to certain records? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/71 X-Sequence-Number: 36725 Hi, is there a way to limit access for some users only to certain records? e.g. there is a customer table and there are account-managers. Could I limit account-manager #1 so that he only can access customers only acording to a flag? Say I create a relation cu_am ( customer_id, account_manager_id ). Could I let the database control that account-manager #1 can only see customers who are assigned to him in the cu_am-relation? For now I do this in the front-end but this is easily circumvented for anyone who has a clue and uses some other client like psql. Regards Andreas