Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yuq6D-0000lE-PD for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2015 22:34:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yuq6C-0001eY-In for pgsql-bugs@arkaria.postgresql.org; Tue, 19 May 2015 22:34:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YuokA-0004sm-59 for pgsql-bugs@postgresql.org; Tue, 19 May 2015 21:08:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1Yuok7-0000mG-CL for pgsql-bugs@postgresql.org; Tue, 19 May 2015 21:08:05 +0000 MIME-Version: 1.0 Subject: BUG #13318: refresh materilaized view privileges To: pgsql-bugs@postgresql.org From: Adrien.Sales@gmail.com Date: Tue, 19 May 2015 21:07:27 +0000 Message-ID: <20150519210727.26514.22507@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 The following bug has been logged on the website: Bug reference: 13318 Logged by: Adrien Sales Email address: Adrien.Sales@gmail.com PostgreSQL version: 9.3.6 Operating system: Linux, Windows Description: Introduction : I don't think it's a bug but rather a Work As Designed feature, indeed, it would be very useful to make it work the same way Oracle does. Description : A user (user_usr) needs to refresh a materialized view that he does not own (the owner is user_adm). This user has all DML privileges on user_adm schema but no DDL privileges. On oracle, when we have the same need (for example for truncating a table), we embed the sql in a stored procedure, grant execute privilege on the procedure... and the job is done...but it does not work on PostgreSQL as it does still complain that "ERROR: must be owner of relation". Please find deblow the script used to test : psql -U user_adm test create table titi(i integer); insert into titi values (1); insert into titi values (2); insert into titi values (3); insert into titi values (4); select * from titi; create materialized view vm_titi as select * from titi; REFRESH MATERIALIZED VIEW vm_titi with data; CREATE OR REPLACE FUNCTION refresh_astre() RETURNS void AS $$ BEGIN REFRESH MATERIALIZED VIEW vm_titi with data; RETURN; END; $$ LANGUAGE plpgsql; select refresh_astre(); grant execute on function refresh_astre() to user_usr; psql -U user_usr test test=> select refresh_astre(); ERROR: must be owner of relation vm_titi CONTEXT: SQL statement "REFRESH MATERIALIZED VIEW vm_titi with data" PL/pgSQL function refresh_astre() line 6 at EXECUTE statement Any feedback would be appreciated on this behavior. The constraint is that we don't want the user_usr user to own any objects, but only to use the user_adm ones. Thank you in advance for your help. Best Regards, Adrien -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs