X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8A4D5475CBC for ; Tue, 29 Apr 2003 17:03:20 -0400 (EDT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id ABF5C475F34 for ; Tue, 29 Apr 2003 17:03:17 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3D5F6D61C; Tue, 29 Apr 2003 14:03:14 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 330EA5C0A; Tue, 29 Apr 2003 14:03:14 -0700 (PDT) Date: Tue, 29 Apr 2003 14:03:14 -0700 (PDT) From: Stephan Szabo To: Sergey Holod Cc: Subject: Re: Making "SECURITY DEFINER" procedures.. In-Reply-To: <200304292358.35245.sss@radiocom.net.ua> Message-ID: <20030429140220.I53158-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-26.0 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, 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: 200304/431 X-Sequence-Number: 13132 On Tue, 29 Apr 2003, Sergey Holod wrote: > Just trying to make subj > > I made user "data", schema "data", several tables and small procedures on them > in that schema and then a greater function (as "SECURITY DEFINER") in > "public" schema which uses previous functions. > I graned "EXECUTE" access to that function to "PUBLIC". > > When I try execute that function I get "ERROR: data: permission denied", but > when I add some notices between parts of function I see following: > > tst=> select new_session('sergey','mypassword'); > NOTICE: current user is data > NOTICE: after delete > NOTICE: after select > NOTICE: after insert > NOTICE: before return > ERROR: data: permission denied > > so function executed with "data" privilegies, It deletes some data, > inserts another and so on, It even runs till "return", but then I get error... > > It seems last error takes place during "auto commit" of transaction in which > function executes.. > > Just don't undestand what is happens..:( What is the function and the schema of the tables involved? I'd wonder about triggers or foreign key constraints or something of that sort.