Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5BB2086E04A for ; Mon, 30 Jan 2012 18:35:20 -0400 (AST) Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rrzol-0000el-AQ for pgsql-bugs@postgresql.org; Mon, 30 Jan 2012 22:35:20 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RrzoY-0007Hi-89 for pgsql-bugs@postgresql.org; Mon, 30 Jan 2012 22:35:07 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1RrzoX-0005KH-U2 for pgsql-bugs@postgresql.org; Mon, 30 Jan 2012 22:35:05 +0000 Date: Mon, 30 Jan 2012 22:35:05 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6421: Revoke column level privilage To: pgsql-bugs@postgresql.org From: bdmytrak@eranet.pl X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/257 X-Sequence-Number: 32324 The following bug has been logged on the website: Bug reference: 6421 Logged by: Bartosz Dmytrak Email address: bdmytrak@eranet.pl PostgreSQL version: 9.1.2 Operating system: Mandriva 2011 64 bit Description: = Cannot revoke column level privilages. Scenario: 1. as =E2=80=9Epostgres=E2=80=9D user create a test table: CREATE TABLE public."tblTest" ( "RowId" serial NOT NULL, "Column1" text, "Column2" integer, "Column3" integer, CONSTRAINT "tblTest_pkey" PRIMARY KEY ("RowId") ) WITH ( OIDS=3DFALSE ); ALTER TABLE public."tblTest" OWNER TO postgres; GRANT ALL ON TABLE public."tblTest" TO postgres; 2. Grant privilages to different user, still using postgres acount: GRANT UPDATE, INSERT, DELETE, REFERENCES, TRIGGER ON TABLE public."tblTest" TO "otherUser"; GRANT SELECT ON TABLE public."tblTest" TO "otherUser" WITH GRANT OPTION; 3. Check privilages (assumption: there is the only one table named =E2=80= =9CtblTest=E2=80=9D in the database): SELECT oid, relname, relacl FROM pg_class WHERE relname =3D 'tblTest'; oid | relname | relacl = -------+---------+-------------------------------------------------------- 36385 | tblTest | {postgres=3DarwdDxt/postgres,otherUser=3Dar*wdxt/postgre= s} (1 row) and also for columns: SELECT attrelid, attname, attacl FROM pg_attribute a INNER JOIN pg_class c ON (a.attrelid =3D c.oid) WHERE c.relname =3D 'tblTest'; attrelid | attname | attacl = ----------+----------+-------- 36385 | tableoid | = 36385 | cmax | = 36385 | xmax | = 36385 | cmin | = 36385 | xmin | = 36385 | ctid | = 36385 | RowId | = 36385 | Column1 | = 36385 | Column2 | = 36385 | Column3 | = (10 rows) Everything looks good. 4. login as =E2=80=9CotherUser=E2=80=9D and add column level privilages myDatabase=3D> GRANT ALL("Column1") ON public."tblTest" TO public; GRANT 5. Check privilages again (as postgres) myDatabase=3D# SELECT oid, relname, relacl FROM pg_class WHERE relname =3D 'tblTest'; oid | relname | relacl = -------+---------+-------------------------------------------------------- 36385 | tblTest | {postgres=3DarwdDxt/postgres,otherUser=3Dar*wdxt/postgre= s} (1 row) myDatabase=3D# SELECT attrelid, attname, attacl FROM pg_attribute a INNER JOIN pg_class c ON (a.attrelid =3D c.oid) WHERE c.relname =3D 'tblTest'; attrelid | attname | attacl = ----------+----------+---------------- 36385 | tableoid | = 36385 | cmax | = 36385 | xmax | = 36385 | cmin | = 36385 | xmin | = 36385 | ctid | = 36385 | RowId | = 36385 | Column1 | {=3Dr/otherUser} 36385 | Column2 | = 36385 | Column3 | = (10 rows) Still looks good. 6. REVOKE Column level privilages from public on table using =E2=80=9Cpostg= res=E2=80=9D account: myDatabase=3D# REVOKE ALL("Column1") ON public."tblTest" FROM public; REVOKE 7. Check column privilages (as postgres): myDatabase=3D# SELECT attrelid, attname, attacl FROM pg_attribute a INNER JOIN pg_class c ON (a.attrelid =3D c.oid) WHERE c.relname =3D 'tblTest'; attrelid | attname | attacl = ----------+----------+---------------- 36385 | tableoid | = 36385 | cmax | = 36385 | xmax | = 36385 | cmin | = 36385 | xmin | = 36385 | ctid | = 36385 | RowId | = 36385 | Column1 | {=3Dr/otherUser} 36385 | Column2 | = 36385 | Column3 | = (10 rows) or using \dp command: myDatabase=3D# \dp public."tblTest" Access privileges Schema | Name | Type | Access privileges | Column access privileges = --------+---------+-------+----------------------------+-------------------= ------- public | tblTest | table | postgres=3DarwdDxt/postgres +| Column1: = = + | | | otherUser=3Dar*wdxt/postgres | =3Dr/otherUser (1 row) Looks like privilages has not been revoked. regards, Bartek