Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VTcZ9-0005oT-Db for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Oct 2013 19:03:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VTcZ8-0003of-T9 for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Oct 2013 19:03:30 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VTcUa-00037v-CG for pgsql-bugs@postgresql.org; Tue, 08 Oct 2013 18:58:48 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VTcUX-0007bo-2X for pgsql-bugs@postgresql.org; Tue, 08 Oct 2013 18:58:47 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 1FEC45F784; Tue, 8 Oct 2013 15:02:01 -0400 (EDT) Date: Tue, 8 Oct 2013 15:02:01 -0400 From: Stephen Frost To: kurt@roeckx.be Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8512: Can't use columns I can't read in the where clause of a select Message-ID: <20131008190200.GE2706@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H2tAL2or48yc9nWp" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.8.0-25-generic (x86_64) X-Uptime: 14:57:53 up 87 days, 15:07, 6 users, load average: 0.00, 0.04, 0.08 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --H2tAL2or48yc9nWp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * kurt@roeckx.be (kurt@roeckx.be) wrote: > Allows SELECT from any column, or the specific columns listed, of the > specified table, view, or sequence. Also allows the use of COPY TO. This > privilege is also needed to reference existing column values in UPDATE or > DELETE. >=20 >=20 > I read that as "SELECT field1 from table where field2 =3D 1" should work = if I > have grant select(field1), but not on field2. I'm getting a "permission > denied". If I remove the where clause it of course works. You have to have SELECT rights on a column to be able to use it in a conditional (eg: with WHERE). > I'm not sure if the behaviour is expected or not. Maybe I'm reading the > documentation wrong, or maybe the documentation is just wrong. Could > someone please clarify? It's expected. The documentation could perhaps be improved, but the second sentence ("This privilege is also needed..") is intended to cover the case where the column is being referred to *anywhere* in the query, basically, and that applies to SELECT as much as UPDATE or DELETE. Thanks, Stephen --H2tAL2or48yc9nWp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlJUVqgACgkQrzgMPqB3kigZOwCfXed/FjEhQRsK8vybxYGHW7iy lSsAn2+QNTzVJ4eoau8W4bTGx3r9lfFE =yScv -----END PGP SIGNATURE----- --H2tAL2or48yc9nWp--