Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNDj5-00EVTi-Ib for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 16:45:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uNDj3-00BlCz-1N for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Jun 2025 16:45:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uNDj2-00BlCr-OQ for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 16:45:57 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uNDj1-000Pyc-2B for pgsql-hackers@lists.postgresql.org; Thu, 05 Jun 2025 16:45:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 555GjpL81295341; Thu, 5 Jun 2025 12:45:51 -0400 From: Tom Lane To: Noah Misch cc: Laurenz Albe , Pavel Stehule , pgsql-hackers@lists.postgresql.org Subject: Re: Wrong security context for deferred triggers? In-reply-to: <20250605163441.2f.nmisch@google.com> References: <6bca669972ef0d4a665fa83c5b751ab116324f8f.camel@cybertec.at> <2653121.1730737337@sss.pgh.pa.us> <51386e72c47d922ef68eaa67451a52dc3f569843.camel@cybertec.at> <3944969.1737570355@sss.pgh.pa.us> <3e4c8fe7adce2e3956e01bae8f1754830bd2d2bf.camel@cybertec.at> <201480.1737653448@sss.pgh.pa.us> <67338f5d321ae6a4bae646e04b9fe0a1f27dd27c.camel@cybertec.at> <20250415155850.9b.nmisch@google.com> <1283937.1749136204@sss.pgh.pa.us> <20250605163441.2f.nmisch@google.com> Comments: In-reply-to Noah Misch message dated "Thu, 05 Jun 2025 09:34:41 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1295339.1749141951.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 05 Jun 2025 12:45:51 -0400 Message-ID: <1295340.1749141951@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Noah Misch writes: > In postgr.es/m/1071973.1749075038@sss.pgh.pa.us of yesterday's release n= otes > discussion, you wrote "Execute AFTER triggers as the role that was activ= e at > the moment the trigger event was queued." That's a good direction, sinc= e it's > correct for the mid-query case without raising it explicitly. Maybe thi= s way: > + Also, the trigger will always run as the role that queued the trigg= er > + event, unless the trigger function is defined as SECURITY > + DEFINER, in which case it will run as the function owner. WFM. I'd probably write "is marked as" not "is defined as". regards, tom lane