Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j8qLQ-0000TC-Am for pgsql-general@arkaria.postgresql.org; Mon, 02 Mar 2020 19:03:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j8qLO-0004py-G0 for pgsql-general@arkaria.postgresql.org; Mon, 02 Mar 2020 19:03:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j8qLM-0004pq-KB for pgsql-general@lists.postgresql.org; Mon, 02 Mar 2020 19:03:10 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j8qLD-0001GY-DA for pgsql-general@lists.postgresql.org; Mon, 02 Mar 2020 19:03:08 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5301621FEC; Mon, 2 Mar 2020 14:02:56 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 02 Mar 2020 14:02:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=a IOgBCtxtkI6cVZ9yaUkkwwFM8cRKnKEjyvT8woJzLI=; b=tWlY3TuFyjF8qo18F wfokPnXpSFI5/7hchGlPiatzES9TIg2gKLP4UzJ4kUkf2eayXLsfm3EnIsDBBnZh /wwjWl0CNS0SsZa1JjRl8DOAtMFTCYYOTpwe/7e1zPOTAn77q7LdCmuC9f3XdYoG YvyFtwv4btUVxs0GR1nvMTbMgM68C2AJ5BUQcgvPPp2WVkpW7UYTMLkS8kdfF5Ln OzHU56iZ7reLU5qsfUhZlTOx9BB7htypTDTY1m3NTe609bNMlnADEWn7tm4pHzuf 1y+qwku06OS2DKy82PePfTQLIvqD+jR7G29RA7CU4N7DJlqrQ8C2GL4jYbh6hsaB g1uaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=aIOgBCtxtkI6cVZ9yaUkkwwFM8cRKnKEjyvT8woJz LI=; b=hizclIWyuo6ZzXf0MTWvgzVh/nPeEmh3bz/k3hEMhbzszC0WZta3nG0J8 hTsoySGyD7mlu97t3wjbi4QWX4PV5Vw31AMNy4Qg4gb7VyGzxB1FXG54NRtev9Il Eged+3m5ONWZLi/9KTc3sOdZZnKZC1rCGYMWSbAran84sCobo3sZfRm5Awfa9aNH JcWrdDO4WM88JTq//V0nps0acgwFD2ot4gqMo9NQvMuV2EqsjkA7b1iJfzzWBS9s uvjz0Y81LHTcS0495Bp9KjXlqi5iMz7druN14sfKzGmqC/Zq4mJFcequ6KCS/KtY /+qV7TkvX4X5EtnqcGQ4+nNwCAYdg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedruddtgedguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepphhoshhtghhrvg hsqhhlrdhorhhgnecukfhppeehtddrudeljedrkedtrddvnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrg hklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from ranger.suse (50-197-80-2-static.hfc.comcastbusiness.net [50.197.80.2]) by mail.messagingengine.com (Postfix) with ESMTPA id AFE233060BD1; Mon, 2 Mar 2020 14:02:55 -0500 (EST) Subject: Re: Detecting which columns a query will modify in a function called by a trigger To: stan , pgsql-general@lists.postgresql.org References: <20200302185904.GA6528@panix.com> From: Adrian Klaver Message-ID: <30c3c06e-61fa-3210-666d-1696af320a75@aklaver.com> Date: Mon, 2 Mar 2020 11:02:54 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200302185904.GA6528@panix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/2/20 10:59 AM, stan wrote: > I need to implement a fairly fine grained security model. Probably a bit > finer that I can do with the standard ownership functionality. > > My thinking on this is to create a table that contains the users, and a > "permission bit" for each function that they may want to do, vis a vi > altering an existing row,or rows, or inserting new rows. > > Looks relatively straight forward, if fairly time consuming to do. But I > would need to know which column(s) a given query would add..alter from the > function to implement this via a trigger. looks like I see most of what I > need t do this in the docs, but I can't quite figure out if I can get this > down to what column(s) a given trigger will modify. Is this possible? Before you get too far into this I would look at RLS: https://www.postgresql.org/docs/12/ddl-rowsecurity.html > > -- Adrian Klaver adrian.klaver@aklaver.com