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 1ryYPq-00GqxG-KC for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2024 14:43:38 +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 1ryYPo-00Emkf-V6 for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2024 14:43:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryYPo-00EmkW-KF for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2024 14:43:36 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryYPh-002Apq-V7 for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2024 14:43:36 +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 43LEhQ1b2720975; Sun, 21 Apr 2024 10:43:26 -0400 From: Tom Lane To: "David G. Johnston" cc: yudhi s , pgsql-general Subject: Re: error in trigger creation In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Sun, 21 Apr 2024 07:25:14 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2720973.1713710606.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 21 Apr 2024 10:43:26 -0400 Message-ID: <2720974.1713710606@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Sunday, April 21, 2024, yudhi s wrote: >> Are you saying something like below, in which we first create the >> function from super user and then execute the grant? But doesn't that mean, >> each time we want to create a new event trigger we have to be again >> dependent on the "super user" to modify the security definer function? > Dynamic SQL. See “execute” in plpgsql. You might as well just give that user superuser and be done with it. It's foolish to imagine that you have any shred of security left if you're letting a user that's not 100.00% trusted write event triggers. (Much less execute any SQL command whatsoever, which is what it sounds like David is suggesting you create a function to do.) regards, tom lane