Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 36219227497 for ; Tue, 20 Dec 2011 17:53:35 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rd7cr-0001jH-1U for pgsql-bugs@postgresql.org; Tue, 20 Dec 2011 21:53:35 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pBKLrKLQ017367; Tue, 20 Dec 2011 16:53:20 -0500 (EST) To: "Kevin Grittner" cc: pgsql-bugs@postgresql.org Subject: Re: Security definer "generated column" function used in index In-reply-to: <4EF0AD530200002500043EBA@gw.wicourts.gov> References: <4EE203C20200002500043B7D@gw.wicourts.gov> <4EF09B4B0200002500043EA3@gw.wicourts.gov><4EF09B4B0200002500043EA3@gw.wicourts.gov> <16831.1324416468@sss.pgh.pa.us> <4EF0AD530200002500043EBA@gw.wicourts.gov> Comments: In-reply-to "Kevin Grittner" message dated "Tue, 20 Dec 2011 15:44:19 -0600" Date: Tue, 20 Dec 2011 16:53:19 -0500 Message-ID: <17366.1324417999@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -4.5 (----) X-Archive-Number: 201112/180 X-Sequence-Number: 31991 "Kevin Grittner" writes: > ... It wasn't even clear to me that it was > OK to have one security definer function call another, based on the > code comment I quoted, so I didn't want to spend more hours on > attempting to create a test case if it simply wasn't supported. Yes, that's definitely *supposed* to work, though I'll grant that there could be bugs there. It's hard to see how it'd be a race condition though. On reflection what seems most likely is simply that turning these otherwise-inlineable SQL functions into SECURITY DEFINER disabled inline-ing them, resulting in catastrophic degradation of the generated plans, such that they took a lot longer than you were accustomed to (they shouldn't have been "hung" though). regards, tom lane