Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0DD59650F1B for ; Mon, 14 Jul 2008 01:26:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 08023-06 for ; Mon, 14 Jul 2008 01:26:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx27.mail.ru (mx27.mail.ru [194.67.23.23]) by postgresql.org (Postfix) with ESMTP id 255D4650BD9 for ; Mon, 14 Jul 2008 01:26:13 -0300 (ADT) Received: from [195.162.52.178] (port=47723 helo=[192.168.1.1]) by mx27.mail.ru with asmtp id 1KIFdY-000AMo-00 for pgsql-admin@postgresql.org; Mon, 14 Jul 2008 08:26:08 +0400 Date: Mon, 14 Jul 2008 11:26:05 +0600 From: sftf X-Mailer: The Bat! (v2.04.7) Business Reply-To: sftf X-Priority: 3 (Normal) Message-ID: <2810039107.20080714112605@mail.ru> To: pgsql-admin@postgresql.org Subject: Rewrite SELECT WHERE clause on per-session bases. Modifing view source code in one session (user's) from another session (admin's)? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: Not detected X-Mras: OK X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.098 tagged_above=0 required=5 tests=AWL=0.098 X-Spam-Level: X-Archive-Number: 200807/119 X-Sequence-Number: 29729 Hi! In my application's security scheme I'm planing to restrict users to view only particular "types" of records, where "types" is set of WHERE predicates for each view, dynamically defined in application. I believe it's most efficient way to do such things, instead of calling some decision function for each row in view's SELECT, for example. So, for these porposes I need some mechanism allowing "on the fly" modification of view's SELECT's. At the beggining I review CREATE RULE ON SELECT variant, but rules are "database-wide" not "session-wide" and SELECT rules don't allow WHERE clause. My current solution is creating temporary viwes for each application user with appropriate WHERE restrictions at the session begining (but rules could be more convient). By this way view permissions (what "types" user can select fron view) are can't be changed during session (user can't modify view by design). So question is: is it possible to modify view source code in one session (user's) from another session (admin's)? Or may be more convenient way to rewrite SELECT WHERE clause on per-session bases exist (similar to RULES)? Thanks.