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.89) (envelope-from ) id 1i00Sp-0006ba-Qn for pgsql-general@arkaria.postgresql.org; Tue, 20 Aug 2019 09:30:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i00So-0005VP-5R for pgsql-general@arkaria.postgresql.org; Tue, 20 Aug 2019 09:30:02 +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 1i00Sn-0005Ug-Rt for pgsql-general@lists.postgresql.org; Tue, 20 Aug 2019 09:30:01 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i00Si-0001kp-Fd for pgsql-general@lists.postgresql.org; Tue, 20 Aug 2019 09:29:57 +0000 Received: by mail-wm1-x32f.google.com with SMTP id e8so1949544wme.1 for ; Tue, 20 Aug 2019 02:29:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=0Ox9ZBOJRETmwrYah73fJs36GC4mBLrwhqpzNKHSGd0=; b=ndE0f0ajkScULbvArfXfLnfpYS0JRcRUn1wT+aI/Joc9RNdVfE9UQTEVM3CGWw9rxY rRCR/QW+vQELRXr0IKpgAfYS5jPnMROqRauG6QLPN76Ow7PLYhuTvDhPkmhjDfpPXlCk z1zZtZG0ofZS0y4k7Ig2o6jJPJtYOkUtnWEJT02pTQKU1Hcw5goWacfQBic7KlWDS/Lp kwooEatixCBZoI4h46LuK4GIoCzLfpMsCWrIjTt5b5N1u1edMvO8p4P8GkIrP7v1jj1Q /PTunT262zfHI6UizSQ2OrHkBFF2pvTtAbhVp2IQlwa3xyuKiY1+gfmSgJpiec7/sR2R PMOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=0Ox9ZBOJRETmwrYah73fJs36GC4mBLrwhqpzNKHSGd0=; b=T2ruTyRgHhmdNJnFryV5KgZHHaLVFxuf8AfvgfmQcpxRpFLAuPAUMiMzyWg5UdOGSC X9T21ClCu6K+Mcp1FqQFuwm3WpQJhPtReCBVsDZz8Uyo9rp8Vkvx1IXxTSCpEXLFntgq PZ22QseNjB1URC9aLmod/Td+SeOr7bTxk3R25UtK62m9/q0oSW6eITSyPQ57/+G/MYmb bMh96dpgbCVj6sxp/rOl1lMFwd2xv3Bp/saxj9CrCcD6MfU9TqbfdtbBMzZW5s0S5Eh0 PG0mZm5DxByWdEveVHOQD7c7SuWJWUfuwo1RuntnlBoYvXCMb2EM1FJsK2AU6QsOZ8uR 24Pw== X-Gm-Message-State: APjAAAUEBDiaYq+rvCW0vGqOcqW+btVS1J2lozJAUg62n0BpiMv96niC gXp54m5fEeEBIlgpnpGVwMxaKh9rlGs= X-Google-Smtp-Source: APXvYqw2xAGefpzGhm/19Pi/l8l+BlnsEOv99Q24+uVjid9D3tllo/3tEQD0l855tYfkeUEz8rrssQ== X-Received: by 2002:a7b:c929:: with SMTP id h9mr26065942wml.1.1566289783807; Tue, 20 Aug 2019 01:29:43 -0700 (PDT) Received: from localhost.localdomain ([212.186.219.234]) by smtp.gmail.com with ESMTPSA id m188sm27017561wmm.32.2019.08.20.01.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 01:29:43 -0700 (PDT) Message-ID: <42719fe4b0e8cfad2e72d8ddd5fc4c0532c52115.camel@cybertec.at> Subject: Re: Collumn level permissions ? From: Laurenz Albe To: stan , pgsql-general@lists.postgresql.org Date: Tue, 20 Aug 2019 10:29:42 +0200 In-Reply-To: <20190819191702.GA27027@panix.com> References: <20190819191702.GA27027@panix.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk stan wrote: > I do know a way to solve this. I could create a view "B" that is a > view of > tab;e "A" without column "C" on the select, and give a user > permissions on > B, but not on A, or at least I think that would work. > > What I specifically need to do is "hide" one column of a table from a > set > of users. > > Any better way to do this? You can use column permissions: REVOKE SELECT ON mytable FROM auser; GRANT SELECT (col1, col2) ON mytable TO auser; This will cause any query that tries to read any other column to fail with an error. If you don't like that, your technique is good, but don't forget to add "WITH (security_barrier = true)" so that nobody can subvert security. Yours, Laurenz Albe -- +43-670-6056265 Cybertec Schönig & Schönig GmbH Gröhrmühlgasse 26, A-2700 Wiener Neustadt Web: https://www.cybertec-postgresql.com