Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8bC5-0004za-WF for pgsql-general@arkaria.postgresql.org; Sat, 15 Jan 2022 05:01:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8bC3-00036I-Sg for pgsql-general@arkaria.postgresql.org; Sat, 15 Jan 2022 05:01:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8bC3-000368-GJ for pgsql-general@lists.postgresql.org; Sat, 15 Jan 2022 05:01:35 +0000 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n8bBt-00074v-TV for pgsql-general@lists.postgresql.org; Sat, 15 Jan 2022 05:01:34 +0000 Received: by mail-pf1-x433.google.com with SMTP id x83so4591020pfc.0 for ; Fri, 14 Jan 2022 21:01:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=aghe0SKgMitfBm6mwnkAfItQvgFVG1EplNRLvakCWyM=; b=GNekzIYhzY1PJN5NJa83fr5H91DQTW5KsR9xV/Dzk0RD4YWU2NRmd7hJjzbFtIhT4V bJNGibi6vmkSeaFmCQPTlc/+XJk9ajZV0eVDF4rAHkf8UU6sh/lS0dbhHbPUTREvLQaF 5fH/7tPHR9GY/EORa3ST5A1uNCad2uWYnYJ4M7huCWu4qkbzoQ7NCBsyKBgvyK11H8Wf gOaYkMzA1RsCeoslhoo4ZZ/swOx8VMDbE0+35kNcH+b+hLStxLjcCVB5lX7bvRSUv9H9 0+10Ma+1aQ2j8kHAhmReYnmroLG7zaDPOCRLUfFd6kH2kQ0GBPAPP/iI3/sQdXIEkvP2 5Y1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=aghe0SKgMitfBm6mwnkAfItQvgFVG1EplNRLvakCWyM=; b=5lbgoHl+idluHC/JPLwTQ6df1XIV5DTzFQPgeBUEu+HQpUJCrH4E9tqk0mdybKNaiA +3V/XW2KHRvWI2UjW0A/gYT+wBJYvvAs+p7+LcYUx6AIC8YHKGCX/kty+gisLShmL9WM Kpf50n08WWHD7ko0LW9rQ7kT/6KHavi2oEEYzFE4o3KfEsFGbxKt8UvoFE9kmuWIXgMq rIoZPY1YaQLICeni4sQjYkCLsDcH1rh2YsmqjKzOkAWYPabXNZP1eSAKu9HR4oykKGuR d7qTIv9dppqyIQ57gSKKUcIzhCiB2W17ZlPUQiip6mqgvigmpIZo1U0niXeEuMdxs0jR SoRg== X-Gm-Message-State: AOAM531lAsMOog+FYzPR398B3VXDXozldo56rLqdU5cJ7uDDWFZerBSQ qACwmwaZDr06JFI6Hs6zH9k= X-Google-Smtp-Source: ABdhPJzLBNZnpU1Y76UuEGBq51Jf+ULh9gYaAhkcMF3RemfQcjSUAbI5B99P4jXYKSFUqr5rgQQ2yA== X-Received: by 2002:a05:6a00:198a:b0:4bb:2032:2abd with SMTP id d10-20020a056a00198a00b004bb20322abdmr12150054pfl.2.1642222883774; Fri, 14 Jan 2022 21:01:23 -0800 (PST) Received: from jrouhaud (1-171-185-43.dynamic-ip.hinet.net. [1.171.185.43]) by smtp.gmail.com with ESMTPSA id z3sm6382542pjq.32.2022.01.14.21.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 21:01:22 -0800 (PST) Date: Sat, 15 Jan 2022 13:01:18 +0800 From: Julien Rouhaud To: =?utf-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?= Cc: "Zwettler Markus (OIZ)" , "pgsql-general@lists.postgresql.org" Subject: Re: [Extern] Re: postgres event trigger workaround Message-ID: <20220115050118.prd2kkky3ezhaozn@jrouhaud> References: <20220112125517.idglbczyiargb56f@jrouhaud> <6b39241e48fe4f2b8d7f37a5df015536@zuerich.ch> <20220114102355.755ir3gpo6mf7y4j@jrouhaud> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Sat, Jan 15, 2022 at 08:36:21AM +0500, Дмитрий Иванов wrote: > In my solution, all users don't need direct access to the schema because > you have to use the functional API to access it. If you can manage users > with functions, you can close the schema in the same way. > Usually the function is executed with the permissions of the calling user, > which requires permissions for all affected entities. However, if you > specify the "SECURITY DEFINER" parameter at creation, the function will be > executed with the owner's permissions. The owner of the function has no > login permissions but has permissions on the affected entities. In this way > you will close the schema from the roles that have rights to the role > management functions. Sure you can solve most problems with that. But you can't create a database (or a tablespace) from a function so this approach wouldn't cover all of OP's needs, as different approach would be needed for role and db creation.