X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 19F144761C0 for ; Mon, 24 Mar 2003 13:17:06 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 2A88A475F09 for ; Mon, 24 Mar 2003 13:17:01 -0500 (EST) Received: from lamer.pl (localhost [127.0.0.1]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 359E96A231; Mon, 24 Mar 2003 19:16:55 +0100 (CET) From: "Tomasz Myrta" To: Tom Lane Cc: "'pgsql-sql@postgresql.org'" Subject: Re: function with security definer Date: Mon, 24 Mar 2003 19:16:55 +0800 Message-Id: <20030324191655.M26247@klaster.net> In-Reply-To: <12693.1048518122@sss.pgh.pa.us> References: <3E7ED5EE.9090104@klaster.net> <12693.1048518122@sss.pgh.pa.us> X-Mailer: Open WebMail 1.62 20020221 X-OriginatingIP: 217.96.97.171 (jasiek) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 X-Spam-Status: No, hits=-25.9 required=5.0 tests=BAYES_01,DATE_IN_PAST_06_12,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/551 X-Sequence-Number: 12589 > Tomasz Myrta writes: > > [ Can't do SET SESSION AUTHORIZATION in a postgres-owned function ] > > That's because SET SESSION AUTHORIZATION looks to the original login > userid, not the current effective userid, to decide whether you're > allowed to do it. If it didn't work that way, a superuser couldn't > switch to any other identity after becoming a nonprivileged user. Does it mean, that SET SESSION AUTHORIZATION works the same for function created with "security definer" as with "security invoker"? Are there any other cases, when it doesn't work properly? > I don't really see why you think this kluge is better than creating > multiple database users, anyway ... Well, it was just an idea. It is easier to keep all information about users in one table "users" than synchronizing this table with pg_shadow via usesysid and granting/revoking each user one by one (or adding them to groups). It lets me also to give each user as little rights as needed - even depending on which application they currently run (administration panel or web report) Regards, Tomasz Myrta