Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 791CA63221A for ; Mon, 1 Mar 2010 06:34:49 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 85762-04 for ; Mon, 1 Mar 2010 10:34:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.pcl-ipout02.plus.net (relay.pcl-ipout02.plus.net [212.159.7.100]) by mail.postgresql.org (Postfix) with ESMTP id 9A668632202 for ; Mon, 1 Mar 2010 06:34:38 -0400 (AST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAF4ni0vUnw4U/2dsb2JhbACbDnO5IIR7BA Received: from pih-relay08.plus.net ([212.159.14.20]) by relay.pcl-ipout02.plus.net with ESMTP; 01 Mar 2010 10:34:35 +0000 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay08.plus.net with esmtp (Exim) id 1Nm2xP-0002bO-RL; Mon, 01 Mar 2010 10:34:35 +0000 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTPA id 83797418048; Mon, 1 Mar 2010 10:34:35 +0000 (GMT) Message-ID: <4B8B983B.4080205@archonet.com> Date: Mon, 01 Mar 2010 10:34:35 +0000 From: Richard Huxton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9pre) Gecko/20100213 Lightning/1.0b1 Shredder/3.0.2pre MIME-Version: 1.0 To: rawi CC: pgsql-sql@postgresql.org Subject: Re: kind of RULE on SELECT depending on existence of a WHERE condition References: <27741669.post@talk.nabble.com> In-Reply-To: <27741669.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: 9e8771af218f28717cd7713aca83e40a X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.87 tagged_above=-10 required=5 tests=AWL=-0.871, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201003/2 X-Sequence-Number: 33709 On 01/03/10 10:07, rawi wrote: > But - for the case, that an application-programmer or even I (tired, middle > in the night) forget to program the insertion of the needed limiting WHERE > condition - it would be great to have some sort of rule ON SELECT, so a > SELECT without WHERE on the flags would return NOTHING. > > Is there a way to achieve this? Not quite the way you suggest. You could build a series of views with the WHERE conditions built in to them, and grant permissions on those though. -- Richard Huxton Archonet Ltd