Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 4939E1AA5B9B for ; Thu, 28 Jun 2012 12:47:13 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SkGvz-0000tl-5v for pgsql-hackers@postgresql.org; Thu, 28 Jun 2012 15:47:12 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5SFkolA013648; Thu, 28 Jun 2012 11:46:50 -0400 (EDT) From: Tom Lane To: Florian Pflug cc: Kohei KaiGai , Robert Haas , PgHacker Subject: Re: [v9.3] Row-Level Security In-reply-to: <113BF38F-43EC-46D7-93AF-423BEC77B025@phlo.org> References: <13017.1340744395@sss.pgh.pa.us> <45CAFA51-C0CE-481B-86B9-C383E22AD172@phlo.org> <13183.1340897349@sss.pgh.pa.us> <113BF38F-43EC-46D7-93AF-423BEC77B025@phlo.org> Comments: In-reply-to Florian Pflug message dated "Thu, 28 Jun 2012 17:34:13 +0200" Date: Thu, 28 Jun 2012 11:46:50 -0400 Message-ID: <13647.1340898410@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/1717 X-Sequence-Number: 210557 Florian Pflug writes: > On Jun28, 2012, at 17:29 , Tom Lane wrote: >> I believe it works today, because the executor only applies permissions >> checks during query startup. So those checks are executed while still >> within the SECURITY DEFINER context, and should behave as expected. >> Subsequently, the cursor portal is returned to caller and caller can >> execute it to completion, no problem. > Don't we (sometimes?) defer query startup to the first time FETCH is > called? There are things inside individual plan node functions that may only happen when the first row is demanded, but permissions checks are done in ExecutorStart(). regards, tom lane